@@ -48,15 +48,15 @@ public async Task Total_Record_Count_Included()
48
48
var response = await client . SendAsync ( request ) ;
49
49
var responseBody = await response . Content . ReadAsStringAsync ( ) ;
50
50
var documents = JsonConvert . DeserializeObject < Documents > ( responseBody ) ;
51
-
51
+
52
52
// assert
53
53
Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
54
54
Assert . NotNull ( documents . Meta ) ;
55
55
Assert . Equal ( ( long ) expectedCount , ( long ) documents . Meta [ "total-records" ] ) ;
56
56
}
57
57
58
58
[ Fact ]
59
- public async Task Total_Record_Count_Not_Included_When_None ( )
59
+ public async Task Total_Record_Count_Included_When_None ( )
60
60
{
61
61
// arrange
62
62
_context . TodoItems . RemoveRange ( _context . TodoItems ) ;
@@ -75,14 +75,15 @@ public async Task Total_Record_Count_Not_Included_When_None()
75
75
var response = await client . SendAsync ( request ) ;
76
76
var responseBody = await response . Content . ReadAsStringAsync ( ) ;
77
77
var documents = JsonConvert . DeserializeObject < Documents > ( responseBody ) ;
78
-
78
+
79
79
// assert
80
80
Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
81
- Assert . Null ( documents . Meta ) ;
81
+ Assert . NotNull ( documents . Meta ) ;
82
+ Assert . Equal ( 0 , ( long ) documents . Meta [ "total-records" ] ) ;
82
83
}
83
84
84
85
[ Fact ]
85
- public async Task Total_Record_Count_Included_POST ( )
86
+ public async Task Total_Record_Count_Not_Included_In_POST_Response ( )
86
87
{
87
88
// arrange
88
89
_context . TodoItems . RemoveRange ( _context . TodoItems ) ;
@@ -116,15 +117,14 @@ public async Task Total_Record_Count_Included_POST()
116
117
var response = await client . SendAsync ( request ) ;
117
118
var responseBody = await response . Content . ReadAsStringAsync ( ) ;
118
119
var documents = JsonConvert . DeserializeObject < Document > ( responseBody ) ;
119
-
120
+
120
121
// assert
121
122
Assert . Equal ( HttpStatusCode . Created , response . StatusCode ) ;
122
- Assert . NotNull ( documents . Meta ) ;
123
- Assert . Equal ( ( long ) expectedCount , ( long ) documents . Meta [ "total-records" ] ) ;
123
+ Assert . Null ( documents . Meta ) ;
124
124
}
125
125
126
126
[ Fact ]
127
- public async Task Total_Record_Count_Included_PATCH ( )
127
+ public async Task Total_Record_Count_Not_Included_In_PATCH_Response ( )
128
128
{
129
129
// arrange
130
130
_context . TodoItems . RemoveRange ( _context . TodoItems ) ;
@@ -161,11 +161,10 @@ public async Task Total_Record_Count_Included_PATCH()
161
161
var response = await client . SendAsync ( request ) ;
162
162
var responseBody = await response . Content . ReadAsStringAsync ( ) ;
163
163
var documents = JsonConvert . DeserializeObject < Document > ( responseBody ) ;
164
-
164
+
165
165
// assert
166
166
Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
167
- Assert . NotNull ( documents . Meta ) ;
168
- Assert . Equal ( ( long ) expectedCount , ( long ) documents . Meta [ "total-records" ] ) ;
167
+ Assert . Null ( documents . Meta ) ;
169
168
}
170
169
171
170
[ Fact ]
@@ -187,26 +186,26 @@ public async Task EntityThatImplements_IHasMeta_Contains_MetaData()
187
186
// act
188
187
var response = await client . SendAsync ( request ) ;
189
188
var documents = JsonConvert . DeserializeObject < Documents > ( await response . Content . ReadAsStringAsync ( ) ) ;
190
-
189
+
191
190
// assert
192
191
Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
193
192
Assert . NotNull ( documents . Meta ) ;
194
193
Assert . NotNull ( expectedMeta ) ;
195
194
Assert . NotEmpty ( expectedMeta ) ;
196
-
197
- foreach ( var hash in expectedMeta )
195
+
196
+ foreach ( var hash in expectedMeta )
198
197
{
199
- if ( hash . Value is IList )
198
+ if ( hash . Value is IList )
200
199
{
201
200
var listValue = ( IList ) hash . Value ;
202
- for ( var i = 0 ; i < listValue . Count ; i ++ )
201
+ for ( var i = 0 ; i < listValue . Count ; i ++ )
203
202
Assert . Equal ( listValue [ i ] . ToString ( ) , ( ( IList ) documents . Meta [ hash . Key ] ) [ i ] . ToString ( ) ) ;
204
203
}
205
204
else
206
205
{
207
206
Assert . Equal ( hash . Value , documents . Meta [ hash . Key ] ) ;
208
207
}
209
- }
208
+ }
210
209
}
211
210
}
212
211
}
0 commit comments