15
15
using TestBuildingBlocks ;
16
16
using Xunit ;
17
17
18
- namespace UnitTests . Extensions ;
18
+ namespace JsonApiDotNetCoreTests . UnitTests . Configuration ;
19
19
20
20
public sealed class ServiceCollectionExtensionsTests
21
21
{
22
22
[ Fact ]
23
- public void RegisterResource_DeviatingDbContextPropertyName_RegistersCorrectly ( )
23
+ public void Register_resource_from_DbContext_ignores_deviating_DbContext_property_name ( )
24
24
{
25
25
// Arrange
26
26
var services = new ServiceCollection ( ) ;
@@ -39,7 +39,7 @@ public void RegisterResource_DeviatingDbContextPropertyName_RegistersCorrectly()
39
39
}
40
40
41
41
[ Fact ]
42
- public void AddResourceService_Registers_Service_Interfaces_Of_Int32 ( )
42
+ public void Can_register_resource_service_for_Id_type_Int32 ( )
43
43
{
44
44
// Arrange
45
45
var services = new ServiceCollection ( ) ;
@@ -63,7 +63,7 @@ public void AddResourceService_Registers_Service_Interfaces_Of_Int32()
63
63
}
64
64
65
65
[ Fact ]
66
- public void AddResourceService_Registers_Service_Interfaces_Of_Guid ( )
66
+ public void Can_register_resource_service_for_Id_type_Guid ( )
67
67
{
68
68
// Arrange
69
69
var services = new ServiceCollection ( ) ;
@@ -87,7 +87,7 @@ public void AddResourceService_Registers_Service_Interfaces_Of_Guid()
87
87
}
88
88
89
89
[ Fact ]
90
- public void AddResourceService_Throws_If_Type_Does_Not_Implement_Any_Interfaces ( )
90
+ public void Cannot_register_resource_service_for_type_that_does_not_implement_required_interfaces ( )
91
91
{
92
92
// Arrange
93
93
var services = new ServiceCollection ( ) ;
@@ -101,7 +101,7 @@ public void AddResourceService_Throws_If_Type_Does_Not_Implement_Any_Interfaces(
101
101
}
102
102
103
103
[ Fact ]
104
- public void AddResourceRepository_Registers_Repository_Interfaces_Of_Int32 ( )
104
+ public void Can_register_resource_repository_for_Id_type_Int32 ( )
105
105
{
106
106
// Arrange
107
107
var services = new ServiceCollection ( ) ;
@@ -118,7 +118,7 @@ public void AddResourceRepository_Registers_Repository_Interfaces_Of_Int32()
118
118
}
119
119
120
120
[ Fact ]
121
- public void AddResourceRepository_Registers_Repository_Interfaces_Of_Guid ( )
121
+ public void Can_register_resource_repository_for_Id_type_Guid ( )
122
122
{
123
123
// Arrange
124
124
var services = new ServiceCollection ( ) ;
@@ -135,7 +135,7 @@ public void AddResourceRepository_Registers_Repository_Interfaces_Of_Guid()
135
135
}
136
136
137
137
[ Fact ]
138
- public void AddResourceDefinition_Registers_Definition_Interface_Of_Int32 ( )
138
+ public void Can_register_resource_definition_for_Id_type_Int32 ( )
139
139
{
140
140
// Arrange
141
141
var services = new ServiceCollection ( ) ;
@@ -150,7 +150,7 @@ public void AddResourceDefinition_Registers_Definition_Interface_Of_Int32()
150
150
}
151
151
152
152
[ Fact ]
153
- public void AddResourceDefinition_Registers_Definition_Interface_Of_Guid ( )
153
+ public void Can_register_resource_definition_for_Id_type_Guid ( )
154
154
{
155
155
// Arrange
156
156
var services = new ServiceCollection ( ) ;
@@ -164,25 +164,6 @@ public void AddResourceDefinition_Registers_Definition_Interface_Of_Guid()
164
164
provider . GetRequiredService ( typeof ( IResourceDefinition < ResourceOfGuid , Guid > ) ) . Should ( ) . BeOfType < ResourceDefinitionOfGuid > ( ) ;
165
165
}
166
166
167
- [ Fact ]
168
- public void AddJsonApi_With_Context_Uses_Resource_Type_Name_If_NoOtherSpecified ( )
169
- {
170
- // Arrange
171
- var services = new ServiceCollection ( ) ;
172
- services . AddLogging ( ) ;
173
- services . AddDbContext < TestDbContext > ( options => options . UseInMemoryDatabase ( Guid . NewGuid ( ) . ToString ( ) ) ) ;
174
-
175
- // Act
176
- services . AddJsonApi < TestDbContext > ( ) ;
177
-
178
- // Assert
179
- ServiceProvider provider = services . BuildServiceProvider ( ) ;
180
- var resourceGraph = provider . GetRequiredService < IResourceGraph > ( ) ;
181
- ResourceType resourceType = resourceGraph . GetResourceType ( typeof ( ResourceOfInt32 ) ) ;
182
-
183
- resourceType . PublicName . Should ( ) . Be ( "resourceOfInt32s" ) ;
184
- }
185
-
186
167
private sealed class ResourceOfInt32 : Identifiable < int >
187
168
{
188
169
}
@@ -594,7 +575,7 @@ private sealed class TestDbContext : TestableDbContext
594
575
{
595
576
public DbSet < ResourceOfInt32 > ResourcesOfInt32 => Set < ResourceOfInt32 > ( ) ;
596
577
public DbSet < ResourceOfGuid > ResourcesOfGuid => Set < ResourceOfGuid > ( ) ;
597
- public DbSet < Person > People => Set < Person > ( ) ;
578
+ public DbSet < Person > SetOfPersons => Set < Person > ( ) ;
598
579
599
580
public TestDbContext ( DbContextOptions < TestDbContext > options )
600
581
: base ( options )
0 commit comments