@@ -64,6 +64,7 @@ public async Task Can_Get_TodoItems()
64
64
Assert . True ( deserializedBody . Count <= expectedEntitiesPerPage ) ;
65
65
}
66
66
67
+
67
68
[ Fact ]
68
69
public async Task Can_Paginate_TodoItems ( )
69
70
{
@@ -153,6 +154,37 @@ public async Task Can_Get_TodoItem_ById()
153
154
Assert . Equal ( todoItem . Ordinal , deserializedBody . Ordinal ) ;
154
155
}
155
156
157
+ [ Fact ]
158
+ public async Task Can_Get_TodoItem_WithOwner ( )
159
+ {
160
+ // Arrange
161
+ var person = new Person ( ) ;
162
+ var todoItem = _todoItemFaker . Generate ( ) ;
163
+ todoItem . Owner = person ;
164
+ _context . TodoItems . Add ( todoItem ) ;
165
+ _context . SaveChanges ( ) ;
166
+
167
+ var httpMethod = new HttpMethod ( "GET" ) ;
168
+ var route = $ "/api/v1/todo-items/{ todoItem . Id } ?include=owner";
169
+
170
+ var description = new RequestProperties ( "Get TodoItem By Id" , new Dictionary < string , string > {
171
+ { "/todo-items/{id}" , "TodoItem Id" } ,
172
+ { "?include={relationship}" , "Included Relationship" }
173
+ } ) ;
174
+
175
+ // Act
176
+ var response = await _fixture . MakeRequest < TodoItem > ( description , httpMethod , route ) ;
177
+ var body = await response . Content . ReadAsStringAsync ( ) ;
178
+ var deserializedBody = ( TodoItem ) JsonApiDeSerializer . Deserialize ( body , _jsonApiContext ) ;
179
+
180
+ // Assert
181
+ Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
182
+ Assert . Equal ( person . Id , deserializedBody . OwnerId ) ;
183
+ Assert . Equal ( todoItem . Id , deserializedBody . Id ) ;
184
+ Assert . Equal ( todoItem . Description , deserializedBody . Description ) ;
185
+ Assert . Equal ( todoItem . Ordinal , deserializedBody . Ordinal ) ;
186
+ }
187
+
156
188
[ Fact ]
157
189
public async Task Can_Post_TodoItem ( )
158
190
{
0 commit comments