Skip to content

Commit 39bac16

Browse files
committed
Conditionless works for && || ! overloads, still need to look at other calls taking QueryDescriptors, do the same for FilterDescriptor
1 parent 6e1d3a9 commit 39bac16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1409
-817
lines changed

src/Nest.Tests.Unit/BaseJsonTests.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ public BaseJsonTests()
2828
}
2929

3030
protected void JsonEquals(object o, MethodBase method, string fileName = null)
31+
{
32+
var json = TestElasticClient.Serialize(o);
33+
this.JsonEquals(json, method, fileName);
34+
}
35+
protected void JsonEquals(string json, MethodBase method, string fileName = null)
3136
{
3237
var type = method.DeclaringType;
3338
var @namespace = method.DeclaringType.Namespace;
@@ -36,18 +41,27 @@ protected void JsonEquals(object o, MethodBase method, string fileName = null)
3641
var file = Path.Combine(folder, (fileName ?? method.Name) + ".json");
3742
file = Path.Combine(Environment.CurrentDirectory.Replace("bin\\Debug", "").Replace("bin\\Release", ""), file);
3843

39-
var json = TestElasticClient.Serialize(o);
44+
4045
var expected = File.ReadAllText(file);
4146
Assert.True(json.JsonEquals(expected), json);
4247
}
43-
protected void JsonEquals(string json, MethodBase method)
48+
protected void JsonNotEquals(object o, MethodBase method, string fileName = null)
49+
{
50+
var json = TestElasticClient.Serialize(o);
51+
this.JsonNotEquals(json, method, fileName);
52+
}
53+
protected void JsonNotEquals(string json, MethodBase method, string fileName = null)
4454
{
4555
var type = method.DeclaringType;
4656
var @namespace = method.DeclaringType.Namespace;
4757
var folder = @namespace.Replace("Nest.Tests.Unit.", "").Replace(".", "\\");
48-
var file = Path.Combine(folder, method.Name + ".json");
58+
59+
var file = Path.Combine(folder, (fileName ?? method.Name) + ".json");
60+
file = Path.Combine(Environment.CurrentDirectory.Replace("bin\\Debug", "").Replace("bin\\Release", ""), file);
61+
62+
4963
var expected = File.ReadAllText(file);
50-
Assert.True(json.JsonEquals(expected), json);
64+
Assert.False(json.JsonEquals(expected), json);
5165
}
5266
}
5367
}

src/Nest.Tests.Unit/Nest.Tests.Unit.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@
115115
<Compile Include="Properties\AssemblyInfo.cs" />
116116
<Compile Include="PropertyVisitorTests.cs" />
117117
<Compile Include="QueryJson\ConditionLess\ConditionLessTests.cs" />
118+
<Compile Include="QueryJson\ConditionlessBool\ConditionLessBooleanTests.cs" />
119+
<Compile Include="QueryJson\ConditionLess\SemiConditionLessTests.cs" />
118120
<Compile Include="QueryJson\QueriesInQueries\QueriesInQueriesTests.cs" />
119121
<Compile Include="QueryTests\BoolQueryJson.cs" />
120122
<Compile Include="QueryTests\BoostingQueryJson.cs" />
@@ -352,6 +354,15 @@
352354
<None Include="QueryJson\Bool\StaticBoolTest.json">
353355
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
354356
</None>
357+
<None Include="QueryJson\ConditionlessBool\Combination1.json" />
358+
<None Include="QueryJson\ConditionlessBool\Combination2.json" />
359+
<None Include="QueryJson\ConditionlessBool\Combination3.json" />
360+
<None Include="QueryJson\ConditionlessBool\MyTermsNot.json" />
361+
<None Include="QueryJson\ConditionlessBool\MyTermsOr.json" />
362+
<None Include="QueryJson\ConditionlessBool\MyTermsAnd.json" />
363+
<None Include="QueryJson\ConditionlessBool\MyTermNot.json" />
364+
<None Include="QueryJson\ConditionlessBool\MyTerm.json" />
365+
<None Include="QueryJson\ConditionlessBool\MatchAll.json" />
355366
<None Include="QueryJson\ConditionLess\MatchAll.json" />
356367
<None Include="QueryJson\InsideBoolCalls\InsideMust.json" />
357368
<None Include="QueryJson\InsideBoolCalls\InsideMustNot.json" />

0 commit comments

Comments
 (0)