File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed
src/Tests/Nest.Tests.Unit Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+ using System . Threading . Tasks ;
6+ using Elasticsearch . Net ;
7+ using Nest . Tests . MockData . Domain ;
8+ using NUnit . Framework ;
9+
10+ namespace Nest . Tests . Unit . Core . Indices . ClearCache
11+ {
12+ [ TestFixture ]
13+ public class ClearCacheUrlTests : BaseJsonTests
14+ {
15+ [ Test ]
16+ public void FluentIncludesFilterKeys ( )
17+ {
18+ var result = this . _client . ClearCache ( c => c
19+ . FilterCache ( )
20+ . FilterKeys ( "filter_key_1" , "filter_key_2" )
21+ ) ;
22+
23+ var status = result . ConnectionStatus ;
24+ StringAssert . Contains ( "USING NEST IN MEMORY CONNECTION" , result . ConnectionStatus . ResponseRaw . Utf8String ( ) ) ;
25+ StringAssert . EndsWith (
26+ "/_cache/clear?filter_cache=true&filter_keys=filter_key_1%2Cfilter_key_2" ,
27+ status . RequestUrl ) ;
28+ StringAssert . AreEqualIgnoringCase ( "POST" , status . RequestMethod ) ;
29+ }
30+
31+ [ Test ]
32+ public void ObjectInitializerIncludesFilterKeys ( )
33+ {
34+ var request = new ClearCacheRequest
35+ {
36+ FilterCache = true ,
37+ FilterCacheKeys = new [ ]
38+ {
39+ "filter_key_1" ,
40+ "filter_key_2"
41+ }
42+ } ;
43+
44+ var result = this . _client . ClearCache ( request ) ;
45+
46+ var status = result . ConnectionStatus ;
47+ StringAssert . Contains ( "USING NEST IN MEMORY CONNECTION" , result . ConnectionStatus . ResponseRaw . Utf8String ( ) ) ;
48+ StringAssert . EndsWith (
49+ "/_cache/clear?filter_cache=true&filter_keys=filter_key_1%2Cfilter_key_2" ,
50+ status . RequestUrl ) ;
51+ StringAssert . AreEqualIgnoringCase ( "POST" , status . RequestMethod ) ;
52+ }
53+ }
54+ }
Original file line number Diff line number Diff line change 108108 <Compile Include =" Core\Indices\Analysis\Analyzers\AnalyzerTests.cs" />
109109 <Compile Include =" Core\Indices\Analysis\Analyzers\StopWords\StopWordsTests.cs" />
110110 <Compile Include =" Core\Indices\Analysis\TokenFilters\TokenFilterTests.cs" />
111+ <Compile Include =" Core\Indices\ClearCache\ClearCacheUrlTests.cs" />
111112 <Compile Include =" Core\Indices\Similarity\SimilarityTests.cs" />
112113 <Compile Include =" Core\Map\CustomMapping\ImagePluginMappingTests.cs" />
113114 <Compile Include =" Core\Map\Enums\EnumMappingTests.cs" />
You can’t perform that action at this time.
0 commit comments