@@ -124,6 +124,36 @@ public async Task Can_Filter_TodoItems()
124
124
Assert . Equal ( todoItem . Ordinal , todoItemResult . Ordinal ) ;
125
125
}
126
126
127
+ [ Fact ]
128
+ public async Task Can_Filter_TodoItems_Using_Like_Operator ( )
129
+ {
130
+ // Arrange
131
+ var todoItem = _todoItemFaker . Generate ( ) ;
132
+ todoItem . Ordinal = 999999 ;
133
+ _context . TodoItems . Add ( todoItem ) ;
134
+ _context . SaveChanges ( ) ;
135
+ var substring = todoItem . Description . Substring ( 1 , todoItem . Description . Length - 2 ) ;
136
+
137
+ var httpMethod = new HttpMethod ( "GET" ) ;
138
+ var route = $ "/api/v1/todo-items?filter[description]=like:{ substring } ";
139
+
140
+ var description = new RequestProperties ( "Filter TodoItems Where Attribute Like" , new Dictionary < string , string > {
141
+ { "?filter[...]=" , "Filter on attribute" }
142
+ } ) ;
143
+
144
+ // Act
145
+ var response = await _fixture . MakeRequest < TodoItem > ( description , httpMethod , route ) ;
146
+ var body = await response . Content . ReadAsStringAsync ( ) ;
147
+ var deserializedBody = JsonApiDeSerializer . DeserializeList < TodoItem > ( body , _jsonApiContext ) ;
148
+
149
+ // Assert
150
+ Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
151
+ Assert . NotEmpty ( deserializedBody ) ;
152
+
153
+ foreach ( var todoItemResult in deserializedBody )
154
+ Assert . Contains ( substring , todoItem . Description ) ;
155
+ }
156
+
127
157
[ Fact ]
128
158
public async Task Can_Sort_TodoItems_By_Ordinal_Ascending ( )
129
159
{
0 commit comments