File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
src/Examples/JsonApiDotNetCoreExample/Models
test/JsonApiDotNetCoreExampleTests/Acceptance/Spec/DocumentTests Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ public class Person : Identifiable, IHasMeta
20
20
21
21
[ HasMany ( "todo-collections" ) ]
22
22
public virtual List < TodoItemCollection > TodoItemCollections { get ; set ; }
23
+
24
+ [ HasOne ( "unincludeable-item" , Link . All , false ) ]
25
+ public virtual TodoItem UnIncludeableItem { get ; set ; }
23
26
24
27
public Dictionary < string , object > GetMeta ( IJsonApiContext context )
25
28
{
Original file line number Diff line number Diff line change @@ -335,5 +335,29 @@ public async Task Request_ToIncludeDeeplyNestedRelationships_Returns_400()
335
335
// assert
336
336
Assert . Equal ( HttpStatusCode . BadRequest , response . StatusCode ) ;
337
337
}
338
+
339
+ [ Fact ]
340
+ public async Task Request_ToIncludeRelationshipMarkedCanIncludeFalse_Returns_400 ( )
341
+ {
342
+ // arrange
343
+ var person = _context . People . First ( ) ;
344
+
345
+ var builder = new WebHostBuilder ( )
346
+ . UseStartup < Startup > ( ) ;
347
+
348
+ var httpMethod = new HttpMethod ( "GET" ) ;
349
+
350
+ var route = $ "/api/v1/people/{ person . Id } ?include=unincludeable-item";
351
+
352
+ var server = new TestServer ( builder ) ;
353
+ var client = server . CreateClient ( ) ;
354
+ var request = new HttpRequestMessage ( httpMethod , route ) ;
355
+
356
+ // act
357
+ var response = await client . SendAsync ( request ) ;
358
+
359
+ // assert
360
+ Assert . Equal ( HttpStatusCode . BadRequest , response . StatusCode ) ;
361
+ }
338
362
}
339
363
}
You can’t perform that action at this time.
0 commit comments