File tree Expand file tree Collapse file tree 3 files changed +37
-26
lines changed Expand file tree Collapse file tree 3 files changed +37
-26
lines changed Original file line number Diff line number Diff line change 1+ using FluentAssertions ;
2+ using Nest ;
3+ using System ;
4+ using System . Collections . Generic ;
5+ using System . Linq ;
6+ using System . Text ;
7+ using System . Threading . Tasks ;
8+
9+ namespace Tests . QueryDsl
10+ {
11+ public abstract class NotConditionlessWhen : List < Action < QueryContainer > >
12+ {
13+ }
14+ public class NotConditionlessWhen < TQuery > : NotConditionlessWhen where TQuery : IQuery
15+ {
16+ private readonly Func < IQueryContainer , TQuery > _dispatch ;
17+
18+ public NotConditionlessWhen ( Func < IQueryContainer , TQuery > dispatch )
19+ {
20+ _dispatch = dispatch ;
21+ }
22+
23+ public void Add ( Action < TQuery > when )
24+ {
25+ this . Add ( q => Assert ( q , when ) ) ;
26+ }
27+
28+ private void Assert ( IQueryContainer c , Action < TQuery > when )
29+ {
30+ TQuery q = this . _dispatch ( c ) ;
31+ when ( q ) ;
32+ q . Conditionless . Should ( ) . BeFalse ( ) ;
33+ c . IsConditionless . Should ( ) . BeFalse ( ) ;
34+ }
35+ }
36+ }
Original file line number Diff line number Diff line change @@ -98,30 +98,4 @@ public void NotConditionlessWhenExpectedToBe()
9898
9999 private void IsConditionless ( IQueryContainer q , bool be ) => q . IsConditionless . Should ( ) . Be ( be ) ;
100100 }
101-
102- public abstract class NotConditionlessWhen : List < Action < QueryContainer > >
103- {
104- }
105- public class NotConditionlessWhen < TQuery > : NotConditionlessWhen where TQuery : IQuery
106- {
107- private readonly Func < IQueryContainer , TQuery > _dispatch ;
108-
109- public NotConditionlessWhen ( Func < IQueryContainer , TQuery > dispatch )
110- {
111- _dispatch = dispatch ;
112- }
113-
114- public void Add ( Action < TQuery > when )
115- {
116- this . Add ( q => Assert ( q , when ) ) ;
117- }
118-
119- private void Assert ( IQueryContainer c , Action < TQuery > when )
120- {
121- TQuery q = this . _dispatch ( c ) ;
122- when ( q ) ;
123- q . Conditionless . Should ( ) . BeFalse ( ) ;
124- c . IsConditionless . Should ( ) . BeFalse ( ) ;
125- }
126- }
127101}
Original file line number Diff line number Diff line change 566566 <Compile Include =" Framework\EndpointTests\TestState\ClientMethod.cs" />
567567 <Compile Include =" Framework\ManagedElasticsearch\Process\ElasticsearchConsoleOut.cs" />
568568 <Compile Include =" QueryDsl\ConditionlessWhen.cs" />
569+ <Compile Include =" QueryDsl\NotConditionlessWhen.cs" />
569570 <Compile Include =" QueryDsl\Specialized\Percolate\PercolateQueryUsageTests.cs" />
570571 <Compile Include =" Search\MultiSearch\MultiSearchApiTests.cs" />
571572 <Compile Include =" Search\MultiSearch\MultiSearchInvalidApiTests.cs" />
You can’t perform that action at this time.
0 commit comments