File tree 3 files changed +28
-34
lines changed
test/JsonApiDotNetCoreExampleTests/IntegrationTests/EagerLoading
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 2
2
using System . Net . Http ;
3
3
using System . Threading . Tasks ;
4
4
using FluentAssertions ;
5
- using JsonApiDotNetCore . Configuration ;
5
+ using JsonApiDotNetCore . Resources ;
6
6
using JsonApiDotNetCore . Serialization . Objects ;
7
7
using JsonApiDotNetCoreExampleTests . Startups ;
8
8
using Microsoft . EntityFrameworkCore ;
9
+ using Microsoft . Extensions . DependencyInjection ;
9
10
using TestBuildingBlocks ;
10
11
using Xunit ;
11
12
@@ -26,7 +27,7 @@ public EagerLoadingTests(ExampleIntegrationTestContext<TestableStartup<EagerLoad
26
27
27
28
testContext . ConfigureServicesAfterStartup ( services =>
28
29
{
29
- services . AddResourceRepository < BuildingRepository > ( ) ;
30
+ services . AddScoped < IResourceDefinition < Building > , BuildingResourceDefinition > ( ) ;
30
31
} ) ;
31
32
}
32
33
You can’t perform that action at this time.
0 commit comments