File tree Expand file tree Collapse file tree 3 files changed +28
-34
lines changed
test/JsonApiDotNetCoreExampleTests/IntegrationTests/EagerLoading Expand file tree Collapse file tree 3 files changed +28
-34
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ using System . Threading ;
2+ using System . Threading . Tasks ;
3+ using JetBrains . Annotations ;
4+ using JsonApiDotNetCore . Configuration ;
5+ using JsonApiDotNetCore . Resources ;
6+
7+ namespace JsonApiDotNetCoreExampleTests . IntegrationTests . EagerLoading
8+ {
9+ [ UsedImplicitly ( ImplicitUseKindFlags . InstantiatedNoFixedConstructorSignature ) ]
10+ public sealed class BuildingResourceDefinition : JsonApiResourceDefinition < Building >
11+ {
12+ public BuildingResourceDefinition ( IResourceGraph resourceGraph )
13+ : base ( resourceGraph )
14+ {
15+ }
16+
17+ public override Task OnInitializeResourceAsync ( Building resource , CancellationToken cancellationToken )
18+ {
19+ // Must ensure that an instance exists for this required relationship, so that POST succeeds.
20+ resource . PrimaryDoor = new Door ( ) ;
21+
22+ return Task . CompletedTask ;
23+ }
24+ }
25+ }
Original file line number Diff line number Diff line change 22using System . Net . Http ;
33using System . Threading . Tasks ;
44using FluentAssertions ;
5- using JsonApiDotNetCore . Configuration ;
5+ using JsonApiDotNetCore . Resources ;
66using JsonApiDotNetCore . Serialization . Objects ;
77using JsonApiDotNetCoreExampleTests . Startups ;
88using Microsoft . EntityFrameworkCore ;
9+ using Microsoft . Extensions . DependencyInjection ;
910using TestBuildingBlocks ;
1011using Xunit ;
1112
@@ -26,7 +27,7 @@ public EagerLoadingTests(ExampleIntegrationTestContext<TestableStartup<EagerLoad
2627
2728 testContext . ConfigureServicesAfterStartup ( services =>
2829 {
29- services . AddResourceRepository < BuildingRepository > ( ) ;
30+ services . AddScoped < IResourceDefinition < Building > , BuildingResourceDefinition > ( ) ;
3031 } ) ;
3132 }
3233
You can’t perform that action at this time.
0 commit comments