|
4 | 4 | namespace Nest.Tests.Unit.Search.Filter.FilterCalls |
5 | 5 | { |
6 | 6 | [TestFixture] |
7 | | - public class FilterCallsTests : BaseJsonTests |
| 7 | + public class FilterCallsTests : BaseJsonTests |
8 | 8 | { |
9 | 9 | [Test] |
10 | 10 | public void AndFilterCombines() |
11 | 11 | { |
12 | | - var s = new SearchDescriptor<ElasticSearchProject>() |
13 | | - .From(0) |
14 | | - .Take(10) |
15 | | - .Filter(ff=> |
16 | | - ff.And(af=> |
17 | | - af.Term(f=>f.Name, "foo") |
18 | | - || af.Term(f => f.Name, "bar") |
19 | | - )); |
| 12 | + var s = new SearchDescriptor<ElasticSearchProject>() |
| 13 | + .From(0) |
| 14 | + .Take(10) |
| 15 | + .Filter(ff => |
| 16 | + ff.And(af => |
| 17 | + af.Term(f => f.Name, "foo") |
| 18 | + || af.Term(f => f.Name, "bar") |
| 19 | + )); |
| 20 | + this.JsonEquals(s, System.Reflection.MethodInfo.GetCurrentMethod()); |
| 21 | + } |
| 22 | + [Test] |
| 23 | + public void AndFilterMultipleCombines() |
| 24 | + { |
| 25 | + var s = new SearchDescriptor<ElasticSearchProject>() |
| 26 | + .From(0) |
| 27 | + .Take(10) |
| 28 | + .Filter(ff => |
| 29 | + ff.And(af => |
| 30 | + af.Term(f => f.Name, "foo") |
| 31 | + || af.Term(f => f.Name, "bar") |
| 32 | + , af => |
| 33 | + af.Term(f => f.Name, "foo2") |
| 34 | + || af.Term(f => f.Name, "bar2") |
| 35 | + )); |
| 36 | + this.JsonEquals(s, System.Reflection.MethodInfo.GetCurrentMethod()); |
| 37 | + } |
| 38 | + [Test] |
| 39 | + public void OrFilterCombines() |
| 40 | + { |
| 41 | + var s = new SearchDescriptor<ElasticSearchProject>() |
| 42 | + .From(0) |
| 43 | + .Take(10) |
| 44 | + .Filter(ff => |
| 45 | + ff.Or(of => |
| 46 | + of.Term(f => f.Name, "foo") |
| 47 | + && of.Term(f => f.Name, "bar") |
| 48 | + )); |
| 49 | + this.JsonEquals(s, System.Reflection.MethodInfo.GetCurrentMethod()); |
| 50 | + } |
| 51 | + [Test] |
| 52 | + public void OrFilterMultipleCombines() |
| 53 | + { |
| 54 | + var s = new SearchDescriptor<ElasticSearchProject>() |
| 55 | + .From(0) |
| 56 | + .Take(10) |
| 57 | + .Filter(ff => |
| 58 | + ff.Or(of => |
| 59 | + of.Term(f => f.Name, "foo") |
| 60 | + && of.Term(f => f.Name, "bar") |
| 61 | + , of => |
| 62 | + of.Term(f => f.Name, "foo2") |
| 63 | + && of.Term(f => f.Name, "bar2") |
| 64 | + )); |
| 65 | + this.JsonEquals(s, System.Reflection.MethodInfo.GetCurrentMethod()); |
| 66 | + } |
| 67 | + |
| 68 | + [Test] |
| 69 | + public void NotFilterCombines() |
| 70 | + { |
| 71 | + var s = new SearchDescriptor<ElasticSearchProject>() |
| 72 | + .From(0) |
| 73 | + .Take(10) |
| 74 | + .Filter(ff => |
| 75 | + ff.Not(of => |
| 76 | + of.Term(f => f.Name, "foo") |
| 77 | + && of.Term(f => f.Name, "bar") |
| 78 | + )); |
| 79 | + this.JsonEquals(s, System.Reflection.MethodInfo.GetCurrentMethod()); |
| 80 | + } |
| 81 | + |
| 82 | + [Test] |
| 83 | + public void CacheSettingsDoNotSurviceBoolOp() |
| 84 | + { |
| 85 | + var s = new SearchDescriptor<ElasticSearchProject>() |
| 86 | + .From(0) |
| 87 | + .Take(10) |
| 88 | + .Filter(ff => |
| 89 | + ff.Name("first_cache_name").Cache(true).CacheKey("first_cache_key").Term(f => f.Name, "foo") |
| 90 | + && ff.Term(f => f.Name, "bar") |
| 91 | + ); |
| 92 | + this.JsonEquals(s, System.Reflection.MethodInfo.GetCurrentMethod()); |
| 93 | + } |
| 94 | + |
| 95 | + [Test] |
| 96 | + public void CacheSettingsDoNotSurviceBoolOpNew() |
| 97 | + { |
| 98 | + var s = new SearchDescriptor<ElasticSearchProject>() |
| 99 | + .From(0) |
| 100 | + .Take(10) |
| 101 | + .Filter(ff => |
| 102 | + ff.Name("first_cache_name").Cache(true).CacheKey("first_cache_key").Exists(f => f.Name) |
| 103 | + && ff.Exists(f => f.Content) |
| 104 | + ); |
20 | 105 | this.JsonEquals(s, System.Reflection.MethodInfo.GetCurrentMethod()); |
21 | 106 | } |
22 | | - [Test] |
23 | | - public void AndFilterMultipleCombines() |
24 | | - { |
25 | | - var s = new SearchDescriptor<ElasticSearchProject>() |
26 | | - .From(0) |
27 | | - .Take(10) |
28 | | - .Filter(ff => |
29 | | - ff.And(af => |
30 | | - af.Term(f => f.Name, "foo") |
31 | | - || af.Term(f => f.Name, "bar") |
32 | | - , af => |
33 | | - af.Term(f => f.Name, "foo2") |
34 | | - || af.Term(f => f.Name, "bar2") |
35 | | - )); |
36 | | - this.JsonEquals(s, System.Reflection.MethodInfo.GetCurrentMethod()); |
37 | | - } |
38 | | - [Test] |
39 | | - public void OrFilterCombines() |
40 | | - { |
41 | | - var s = new SearchDescriptor<ElasticSearchProject>() |
42 | | - .From(0) |
43 | | - .Take(10) |
44 | | - .Filter(ff => |
45 | | - ff.Or(of => |
46 | | - of.Term(f => f.Name, "foo") |
47 | | - && of.Term(f => f.Name, "bar") |
48 | | - )); |
49 | | - this.JsonEquals(s, System.Reflection.MethodInfo.GetCurrentMethod()); |
50 | | - } |
51 | | - [Test] |
52 | | - public void OrFilterMultipleCombines() |
53 | | - { |
54 | | - var s = new SearchDescriptor<ElasticSearchProject>() |
55 | | - .From(0) |
56 | | - .Take(10) |
57 | | - .Filter(ff => |
58 | | - ff.Or(of => |
59 | | - of.Term(f => f.Name, "foo") |
60 | | - && of.Term(f => f.Name, "bar") |
61 | | - , of => |
62 | | - of.Term(f => f.Name, "foo2") |
63 | | - && of.Term(f => f.Name, "bar2") |
64 | | - )); |
65 | | - this.JsonEquals(s, System.Reflection.MethodInfo.GetCurrentMethod()); |
66 | | - } |
67 | 107 |
|
68 | | - [Test] |
69 | | - public void NotFilterCombines() |
70 | | - { |
71 | | - var s = new SearchDescriptor<ElasticSearchProject>() |
72 | | - .From(0) |
73 | | - .Take(10) |
74 | | - .Filter(ff => |
75 | | - ff.Not(of => |
76 | | - of.Term(f => f.Name, "foo") |
77 | | - && of.Term(f => f.Name, "bar") |
78 | | - )); |
79 | | - this.JsonEquals(s, System.Reflection.MethodInfo.GetCurrentMethod()); |
80 | | - } |
81 | | - |
82 | | - } |
| 108 | + } |
83 | 109 | } |
0 commit comments