@@ -97,7 +97,11 @@ public async Task Can_Filter_TodoItems_Using_IsNotNull_Operator()
97
97
// Arrange
98
98
var todoItem = _todoItemFaker . Generate ( ) ;
99
99
todoItem . UpdatedDate = new DateTime ( ) ;
100
- _context . TodoItems . Add ( todoItem ) ;
100
+
101
+ var otherTodoItem = _todoItemFaker . Generate ( ) ;
102
+ otherTodoItem . UpdatedDate = null ;
103
+
104
+ _context . TodoItems . AddRange ( new [ ] { todoItem , otherTodoItem } ) ;
101
105
_context . SaveChanges ( ) ;
102
106
103
107
var httpMethod = new HttpMethod ( "GET" ) ;
@@ -110,13 +114,11 @@ public async Task Can_Filter_TodoItems_Using_IsNotNull_Operator()
110
114
Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
111
115
112
116
var body = await response . Content . ReadAsStringAsync ( ) ;
113
- var deserializedBody = _fixture . GetService < IJsonApiDeSerializer > ( ) . DeserializeList < TodoItem > ( body ) ;
117
+ var todoItems = _fixture . GetService < IJsonApiDeSerializer > ( ) . DeserializeList < TodoItem > ( body ) ;
114
118
115
119
// Assert
116
- Assert . NotEmpty ( deserializedBody ) ;
117
-
118
- foreach ( var todoItemResult in deserializedBody )
119
- Assert . Equal ( todoItem . Ordinal , todoItemResult . Ordinal ) ;
120
+ Assert . NotEmpty ( todoItems ) ;
121
+ Assert . All ( todoItems , t => Assert . NotNull ( t . UpdatedDate ) ) ;
120
122
}
121
123
122
124
[ Fact ]
@@ -125,7 +127,11 @@ public async Task Can_Filter_TodoItems_Using_IsNull_Operator()
125
127
// Arrange
126
128
var todoItem = _todoItemFaker . Generate ( ) ;
127
129
todoItem . UpdatedDate = null ;
128
- _context . TodoItems . Add ( todoItem ) ;
130
+
131
+ var otherTodoItem = _todoItemFaker . Generate ( ) ;
132
+ otherTodoItem . UpdatedDate = new DateTime ( ) ;
133
+
134
+ _context . TodoItems . AddRange ( new [ ] { todoItem , otherTodoItem } ) ;
129
135
_context . SaveChanges ( ) ;
130
136
131
137
var httpMethod = new HttpMethod ( "GET" ) ;
@@ -138,13 +144,11 @@ public async Task Can_Filter_TodoItems_Using_IsNull_Operator()
138
144
Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
139
145
140
146
var body = await response . Content . ReadAsStringAsync ( ) ;
141
- var deserializedBody = _fixture . GetService < IJsonApiDeSerializer > ( ) . DeserializeList < TodoItem > ( body ) ;
147
+ var todoItems = _fixture . GetService < IJsonApiDeSerializer > ( ) . DeserializeList < TodoItem > ( body ) ;
142
148
143
149
// Assert
144
- Assert . NotEmpty ( deserializedBody ) ;
145
-
146
- foreach ( var todoItemResult in deserializedBody )
147
- Assert . Equal ( todoItem . Ordinal , todoItemResult . Ordinal ) ;
150
+ Assert . NotEmpty ( todoItems ) ;
151
+ Assert . All ( todoItems , t => Assert . Null ( t . UpdatedDate ) ) ;
148
152
}
149
153
150
154
[ Fact ]
0 commit comments