Skip to content

Commit eedd56d

Browse files
committed
Posty cherry-pick build fix
1 parent 0b690d4 commit eedd56d

File tree

3 files changed

+37
-26
lines changed

3 files changed

+37
-26
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
}

src/Tests/QueryDsl/QueryDslUsageTestsBase.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff 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
}

src/Tests/Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@
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" />

0 commit comments

Comments
 (0)