File tree 1 file changed +48
-1
lines changed
test/JsonApiDotNetCoreTests/IntegrationTests/Serialization
1 file changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -169,7 +169,54 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
169
169
}
170
170
171
171
[ Fact ]
172
- public async Task Can_get_primary_resources_with_empty_include ( )
172
+ public async Task Can_get_primary_resource_with_empty_ToOne_include ( )
173
+ {
174
+ // Arrange
175
+ MeetingAttendee attendee = _fakers . MeetingAttendee . Generate ( ) ;
176
+
177
+ await _testContext . RunOnDatabaseAsync ( async dbContext =>
178
+ {
179
+ dbContext . Attendees . Add ( attendee ) ;
180
+ await dbContext . SaveChangesAsync ( ) ;
181
+ } ) ;
182
+
183
+ string route = $ "/meetingAttendees/{ attendee . StringId } ?include=meeting";
184
+
185
+ // Act
186
+ ( HttpResponseMessage httpResponse , string responseDocument ) = await _testContext . ExecuteGetAsync < string > ( route ) ;
187
+
188
+ // Assert
189
+ httpResponse . Should ( ) . HaveStatusCode ( HttpStatusCode . OK ) ;
190
+
191
+ responseDocument . Should ( ) . BeJson ( @"{
192
+ ""links"": {
193
+ ""self"": ""http://localhost/meetingAttendees/" + attendee . StringId + @"?include=meeting""
194
+ },
195
+ ""data"": {
196
+ ""type"": ""meetingAttendees"",
197
+ ""id"": """ + attendee . StringId + @""",
198
+ ""attributes"": {
199
+ ""displayName"": """ + attendee . DisplayName + @"""
200
+ },
201
+ ""relationships"": {
202
+ ""meeting"": {
203
+ ""links"": {
204
+ ""self"": ""http://localhost/meetingAttendees/" + attendee . StringId + @"/relationships/meeting"",
205
+ ""related"": ""http://localhost/meetingAttendees/" + attendee . StringId + @"/meeting""
206
+ },
207
+ ""data"": null
208
+ }
209
+ },
210
+ ""links"": {
211
+ ""self"": ""http://localhost/meetingAttendees/" + attendee . StringId + @"""
212
+ }
213
+ },
214
+ ""included"": []
215
+ }" ) ;
216
+ }
217
+
218
+ [ Fact ]
219
+ public async Task Can_get_primary_resources_with_empty_ToMany_include ( )
173
220
{
174
221
// Arrange
175
222
Meeting meeting = _fakers . Meeting . Generate ( ) ;
You can’t perform that action at this time.
0 commit comments