@@ -5,6 +5,7 @@ public abstract class QueryEntryTestsBase : MiniLcmTestBase
55 private readonly string Apple = "Apple" ;
66 private readonly string Peach = "Peach" ;
77 private readonly string Banana = "Banana" ;
8+ private readonly string Kiwi = "Kiwi" ;
89
910 public override async Task InitializeAsync ( )
1011 {
@@ -59,6 +60,27 @@ await Api.CreateEntry(new Entry()
5960 }
6061 ]
6162 } ) ;
63+ await Api . CreateEntry ( new Entry ( )
64+ {
65+ LexemeForm = { { "en" , Kiwi } } ,
66+ Senses =
67+ [
68+ new ( )
69+ {
70+ Gloss = { { "en" , "Fruit" } } ,
71+ Definition = { { "en" , "Fruit, fuzzy with green flesh" } } ,
72+ PartOfSpeechId = nounPos . Id ,
73+ SemanticDomains = [ semanticDomain ] ,
74+ ExampleSentences =
75+ [
76+ new ExampleSentence ( )
77+ {
78+ Sentence = { { "en" , "I like eating Kiwis, they taste good" } }
79+ } ,
80+ ]
81+ }
82+ ]
83+ } ) ;
6284 }
6385
6486 [ Fact ]
@@ -68,18 +90,28 @@ public async Task CanFilterToMissingSenses()
6890 results . Select ( e => e . LexemeForm [ "en" ] ) . Should ( ) . BeEquivalentTo ( Apple ) ;
6991 }
7092
93+ [ Fact ]
94+ public async Task CanFilterToNotMissingSenses ( )
95+ {
96+ var results = await Api . GetEntries ( new ( Filter : new ( ) { GridifyFilter = "Senses!=null" } ) ) . ToArrayAsync ( ) ;
97+ results . Select ( e => e . LexemeForm [ "en" ] ) . Should ( ) . BeEquivalentTo ( Kiwi , Peach , Banana ) ;
98+ }
99+
71100 [ Fact ]
72101 public async Task CanFilterToMissingPartOfSpeech ( )
73102 {
74103 var results = await Api . GetEntries ( new ( Filter : new ( ) { GridifyFilter = "Senses.PartOfSpeechId=null" } ) ) . ToArrayAsync ( ) ;
104+ //does not include entries with no senses
75105 results . Select ( e => e . LexemeForm [ "en" ] ) . Should ( ) . BeEquivalentTo ( Peach ) ;
76106 }
77107
78108 [ Fact ]
79109 public async Task CanFilterToMissingExamples ( )
80110 {
81111 var results = await Api . GetEntries ( new ( Filter : new ( ) { GridifyFilter = "Senses.ExampleSentences=null" } ) ) . ToArrayAsync ( ) ;
82- results . Select ( e => e . LexemeForm [ "en" ] ) . Should ( ) . BeEquivalentTo ( [ Apple , Peach ] ) ;
112+ //Senses.ExampleSentences=null matches entries which have senses but no examples
113+ //it does not include Apple because it has no senses, to include it a filter Senses=null is needed
114+ results . Select ( e => e . LexemeForm [ "en" ] ) . Should ( ) . BeEquivalentTo ( Peach , Banana ) ;
83115 }
84116
85117 [ Fact ]
@@ -100,21 +132,21 @@ public async Task CanFilterToMissingSemanticDomainsWithEmptyArray()
100132 public async Task CanFilterSemanticDomainCodeContains ( )
101133 {
102134 var results = await Api . GetEntries ( new ( Filter : new ( ) { GridifyFilter = "Senses.SemanticDomains.Code=*Fruit" } ) ) . ToArrayAsync ( ) ;
103- results . Select ( e => e . LexemeForm [ "en" ] ) . Should ( ) . BeEquivalentTo ( Banana ) ;
135+ results . Select ( e => e . LexemeForm [ "en" ] ) . Should ( ) . BeEquivalentTo ( Banana , Kiwi ) ;
104136 }
105137
106138 [ Fact ]
107139 public async Task CanFilterToMissingComplexFormTypes ( )
108140 {
109141 var results = await Api . GetEntries ( new ( Filter : new ( ) { GridifyFilter = "ComplexFormTypes=null" } ) ) . ToArrayAsync ( ) ;
110- results . Select ( e => e . LexemeForm [ "en" ] ) . Should ( ) . BeEquivalentTo ( Apple , Banana ) ;
142+ results . Select ( e => e . LexemeForm [ "en" ] ) . Should ( ) . BeEquivalentTo ( Apple , Banana , Kiwi ) ;
111143 }
112144
113145 [ Fact ]
114146 public async Task CanFilterToMissingComplexFormTypesWithEmptyArray ( )
115147 {
116148 var results = await Api . GetEntries ( new ( Filter : new ( ) { GridifyFilter = "ComplexFormTypes=[]" } ) ) . ToArrayAsync ( ) ;
117- results . Select ( e => e . LexemeForm [ "en" ] ) . Should ( ) . BeEquivalentTo ( Apple , Banana ) ;
149+ results . Select ( e => e . LexemeForm [ "en" ] ) . Should ( ) . BeEquivalentTo ( Apple , Banana , Kiwi ) ;
118150 }
119151
120152 [ Fact ]
@@ -163,7 +195,7 @@ public async Task CanFilterGlossEmpty()
163195 public async Task CanFilterGlossEqualsFruit ( )
164196 {
165197 var results = await Api . GetEntries ( new ( Filter : new ( ) { GridifyFilter = "Senses.Gloss[en]=Fruit" } ) ) . ToArrayAsync ( ) ;
166- results . Select ( e => e . LexemeForm [ "en" ] ) . Should ( ) . BeEquivalentTo ( Banana ) ;
198+ results . Select ( e => e . LexemeForm [ "en" ] ) . Should ( ) . BeEquivalentTo ( Banana , Kiwi ) ;
167199 }
168200
169201 [ Fact ]
0 commit comments