11
11
using Microsoft . EntityFrameworkCore ;
12
12
using Newtonsoft . Json ;
13
13
using Xunit ;
14
- using Person = JsonApiDotNetCoreExample . Models . Person ;
15
14
16
15
namespace JsonApiDotNetCoreExampleTests . Acceptance
17
16
{
@@ -21,6 +20,7 @@ public class ManyToManyTests
21
20
private static readonly Faker < Article > _articleFaker = new Faker < Article > ( )
22
21
. RuleFor ( a => a . Name , f => f . Random . AlphaNumeric ( 10 ) )
23
22
. RuleFor ( a => a . Author , f => new Author ( ) ) ;
23
+
24
24
private static readonly Faker < Tag > _tagFaker = new Faker < Tag > ( ) . RuleFor ( a => a . Name , f => f . Random . AlphaNumeric ( 10 ) ) ;
25
25
26
26
private TestFixture < TestStartup > _fixture ;
@@ -66,9 +66,9 @@ public async Task Can_Create_Many_To_Many()
66
66
// arrange
67
67
var context = _fixture . GetService < AppDbContext > ( ) ;
68
68
var tag = _tagFaker . Generate ( ) ;
69
- var author = new Person ( ) ;
69
+ var author = new Author ( ) ;
70
70
context . Tags . Add ( tag ) ;
71
- context . People . Add ( author ) ;
71
+ context . Authors . Add ( author ) ;
72
72
await context . SaveChangesAsync ( ) ;
73
73
74
74
var article = _articleFaker . Generate ( ) ;
@@ -85,7 +85,7 @@ public async Task Can_Create_Many_To_Many()
85
85
{ "author" , new {
86
86
data = new
87
87
{
88
- type = "people " ,
88
+ type = "authors " ,
89
89
id = author . StringId
90
90
}
91
91
} } ,
@@ -111,7 +111,7 @@ public async Task Can_Create_Many_To_Many()
111
111
// assert
112
112
var body = await response . Content . ReadAsStringAsync ( ) ;
113
113
Assert . True ( HttpStatusCode . Created == response . StatusCode , $ "{ route } returned { response . StatusCode } status code with payload: { body } ") ;
114
-
114
+
115
115
var articleResponse = _fixture . GetService < IJsonApiDeSerializer > ( ) . Deserialize < Article > ( body ) ;
116
116
Assert . NotNull ( articleResponse ) ;
117
117
0 commit comments