File tree 1 file changed +29
-1
lines changed
test/JsonApiDotNetCoreExampleTests/Acceptance
1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,34 @@ public async Task Can_Fetch_Many_To_Many_Through_GetById()
110
110
Assert . Equal ( tag . Name , tagResponse . Name ) ;
111
111
}
112
112
113
+ [ Fact ]
114
+ public async Task Can_Fetch_Many_To_Many_Without_Include ( )
115
+ {
116
+ // arrange
117
+ var context = _fixture . GetService < AppDbContext > ( ) ;
118
+ var article = _articleFaker . Generate ( ) ;
119
+ var tag = _tagFaker . Generate ( ) ;
120
+ var articleTag = new ArticleTag
121
+ {
122
+ Article = article ,
123
+ Tag = tag
124
+ } ;
125
+ context . ArticleTags . Add ( articleTag ) ;
126
+ await context . SaveChangesAsync ( ) ;
127
+
128
+ var route = $ "/api/v1/articles/{ article . Id } ";
129
+
130
+ // act
131
+ var response = await _fixture . Client . GetAsync ( route ) ;
132
+
133
+ // assert
134
+ var body = await response . Content . ReadAsStringAsync ( ) ;
135
+ Assert . True ( HttpStatusCode . OK == response . StatusCode , $ "{ route } returned { response . StatusCode } status code with payload: { body } ") ;
136
+
137
+ var document = JsonConvert . DeserializeObject < Document > ( body ) ;
138
+ Assert . Null ( document . Data . Relationships [ "tags" ] . ManyData ) ;
139
+ }
140
+
113
141
[ Fact ]
114
142
public async Task Can_Create_Many_To_Many ( )
115
143
{
@@ -269,4 +297,4 @@ public async Task Can_Update_Many_To_Many_Through_Relationship_Link()
269
297
Assert . Equal ( tag . Id , persistedArticleTag . TagId ) ;
270
298
}
271
299
}
272
- }
300
+ }
You can’t perform that action at this time.
0 commit comments