@@ -181,46 +181,7 @@ public async Task Cannot_omit_attribute(string attributePropertyName, string jso
181
181
182
182
[ Theory ]
183
183
[ InlineData ( nameof ( ResourceRelationshipsInPostRequest . ToOne ) , "toOne" ) ]
184
- public async Task Can_clear_relationship_with_partial_attribute_serialization ( string relationshipPropertyName , string jsonPropertyName )
185
- {
186
- // Arrange
187
- var requestDocument = new ResourcePostRequestDocument
188
- {
189
- Data = new ResourceDataInPostRequest
190
- {
191
- Attributes = _fakers . PostAttributes . Generate ( ) ,
192
- Relationships = new ResourceRelationshipsInPostRequest
193
- {
194
- ToOne = _fakers . NullableToOne . Generate ( ) ,
195
- RequiredToOne = _fakers . ToOne . Generate ( ) ,
196
- ToMany = _fakers . ToMany . Generate ( ) ,
197
- RequiredToMany = _fakers . ToMany . Generate ( )
198
- }
199
- }
200
- } ;
201
-
202
- SetDataPropertyToNull ( requestDocument . Data . Relationships , relationshipPropertyName ) ;
203
-
204
- using var wrapper = FakeHttpClientWrapper . Create ( HttpStatusCode . NoContent , null ) ;
205
- var apiClient = new NrtOffMsvOnClient ( wrapper . HttpClient ) ;
206
-
207
- using IDisposable _ = apiClient . WithPartialAttributeSerialization < ResourcePostRequestDocument , ResourceAttributesInPostRequest > ( requestDocument ) ;
208
-
209
- // Act
210
- await ApiResponse . TranslateAsync ( async ( ) => await apiClient . PostResourceAsync ( requestDocument ) ) ;
211
-
212
- // Assert
213
- JsonElement document = wrapper . GetRequestBodyAsJson ( ) ;
214
-
215
- document . Should ( ) . ContainPath ( $ "data.relationships.{ jsonPropertyName } .data") . With ( relationshipDataObject =>
216
- {
217
- relationshipDataObject . ValueKind . Should ( ) . Be ( JsonValueKind . Null ) ;
218
- } ) ;
219
- }
220
-
221
- [ Theory ]
222
- [ InlineData ( nameof ( ResourceRelationshipsInPostRequest . ToOne ) , "toOne" ) ]
223
- public async Task Can_clear_relationship_without_partial_attribute_serialization ( string relationshipPropertyName , string jsonPropertyName )
184
+ public async Task Can_clear_relationship ( string relationshipPropertyName , string jsonPropertyName )
224
185
{
225
186
// Arrange
226
187
var requestDocument = new ResourcePostRequestDocument
@@ -259,46 +220,7 @@ public async Task Can_clear_relationship_without_partial_attribute_serialization
259
220
[ InlineData ( nameof ( ResourceRelationshipsInPostRequest . RequiredToOne ) , "requiredToOne" ) ]
260
221
[ InlineData ( nameof ( ResourceRelationshipsInPostRequest . ToMany ) , "toMany" ) ]
261
222
[ InlineData ( nameof ( ResourceRelationshipsInPostRequest . RequiredToMany ) , "requiredToMany" ) ]
262
- public async Task Cannot_clear_relationship_with_partial_attribute_serialization ( string relationshipPropertyName , string jsonPropertyName )
263
- {
264
- // Arrange
265
- var requestDocument = new ResourcePostRequestDocument
266
- {
267
- Data = new ResourceDataInPostRequest
268
- {
269
- Attributes = _fakers . PostAttributes . Generate ( ) ,
270
- Relationships = new ResourceRelationshipsInPostRequest
271
- {
272
- ToOne = _fakers . NullableToOne . Generate ( ) ,
273
- RequiredToOne = _fakers . ToOne . Generate ( ) ,
274
- ToMany = _fakers . ToMany . Generate ( ) ,
275
- RequiredToMany = _fakers . ToMany . Generate ( )
276
- }
277
- }
278
- } ;
279
-
280
- SetDataPropertyToNull ( requestDocument . Data . Relationships , relationshipPropertyName ) ;
281
-
282
- using var wrapper = FakeHttpClientWrapper . Create ( HttpStatusCode . NoContent , null ) ;
283
- var apiClient = new NrtOffMsvOnClient ( wrapper . HttpClient ) ;
284
-
285
- using IDisposable _ = apiClient . WithPartialAttributeSerialization < ResourcePostRequestDocument , ResourceAttributesInPostRequest > ( requestDocument ) ;
286
-
287
- // Act
288
- Func < Task < ResourcePrimaryResponseDocument ? > > action = async ( ) => await apiClient . PostResourceAsync ( requestDocument ) ;
289
-
290
- // Assert
291
- ExceptionAssertions < JsonSerializationException > assertion = await action . Should ( ) . ThrowExactlyAsync < JsonSerializationException > ( ) ;
292
-
293
- assertion . Which . Message . Should ( ) . Be (
294
- $ "Cannot write a null value for property 'data'. Property requires a value. Path 'data.relationships.{ jsonPropertyName } '.") ;
295
- }
296
-
297
- [ Theory ]
298
- [ InlineData ( nameof ( ResourceRelationshipsInPostRequest . RequiredToOne ) , "requiredToOne" ) ]
299
- [ InlineData ( nameof ( ResourceRelationshipsInPostRequest . ToMany ) , "toMany" ) ]
300
- [ InlineData ( nameof ( ResourceRelationshipsInPostRequest . RequiredToMany ) , "requiredToMany" ) ]
301
- public async Task Cannot_clear_relationship_without_partial_attribute_serialization ( string relationshipPropertyName , string jsonPropertyName )
223
+ public async Task Cannot_clear_relationship ( string relationshipPropertyName , string jsonPropertyName )
302
224
{
303
225
// Arrange
304
226
var requestDocument = new ResourcePostRequestDocument
@@ -335,48 +257,7 @@ public async Task Cannot_clear_relationship_without_partial_attribute_serializat
335
257
[ InlineData ( nameof ( ResourceRelationshipsInPostRequest . ToOne ) , "toOne" ) ]
336
258
[ InlineData ( nameof ( ResourceRelationshipsInPostRequest . ToMany ) , "toMany" ) ]
337
259
[ InlineData ( nameof ( ResourceRelationshipsInPostRequest . RequiredToMany ) , "requiredToMany" ) ]
338
- public async Task Can_omit_relationship_with_partial_attribute_serialization ( string relationshipPropertyName , string jsonPropertyName )
339
- {
340
- // Arrange
341
- var requestDocument = new ResourcePostRequestDocument
342
- {
343
- Data = new ResourceDataInPostRequest
344
- {
345
- Attributes = _fakers . PostAttributes . Generate ( ) ,
346
- Relationships = new ResourceRelationshipsInPostRequest
347
- {
348
- ToOne = _fakers . NullableToOne . Generate ( ) ,
349
- RequiredToOne = _fakers . ToOne . Generate ( ) ,
350
- ToMany = _fakers . ToMany . Generate ( ) ,
351
- RequiredToMany = _fakers . ToMany . Generate ( )
352
- }
353
- }
354
- } ;
355
-
356
- SetPropertyToInitialValue ( requestDocument . Data . Relationships , relationshipPropertyName ) ;
357
-
358
- using var wrapper = FakeHttpClientWrapper . Create ( HttpStatusCode . NoContent , null ) ;
359
- var apiClient = new NrtOffMsvOnClient ( wrapper . HttpClient ) ;
360
-
361
- using IDisposable _ = apiClient . WithPartialAttributeSerialization < ResourcePostRequestDocument , ResourceAttributesInPostRequest > ( requestDocument ) ;
362
-
363
- // Act
364
- await ApiResponse . TranslateAsync ( async ( ) => await apiClient . PostResourceAsync ( requestDocument ) ) ;
365
-
366
- // Assert
367
- JsonElement document = wrapper . GetRequestBodyAsJson ( ) ;
368
-
369
- document . Should ( ) . ContainPath ( "data.relationships" ) . With ( relationshipsObject =>
370
- {
371
- relationshipsObject . Should ( ) . NotContainPath ( jsonPropertyName ) ;
372
- } ) ;
373
- }
374
-
375
- [ Theory ]
376
- [ InlineData ( nameof ( ResourceRelationshipsInPostRequest . ToOne ) , "toOne" ) ]
377
- [ InlineData ( nameof ( ResourceRelationshipsInPostRequest . ToMany ) , "toMany" ) ]
378
- [ InlineData ( nameof ( ResourceRelationshipsInPostRequest . RequiredToMany ) , "requiredToMany" ) ]
379
- public async Task Can_omit_relationship_without_partial_attribute_serialization ( string relationshipPropertyName , string jsonPropertyName )
260
+ public async Task Can_omit_relationship ( string relationshipPropertyName , string jsonPropertyName )
380
261
{
381
262
// Arrange
382
263
var requestDocument = new ResourcePostRequestDocument
@@ -413,44 +294,7 @@ public async Task Can_omit_relationship_without_partial_attribute_serialization(
413
294
414
295
[ Theory ]
415
296
[ InlineData ( nameof ( ResourceRelationshipsInPostRequest . RequiredToOne ) , "requiredToOne" ) ]
416
- public async Task Cannot_omit_relationship_with_partial_attribute_serialization ( string relationshipPropertyName , string jsonPropertyName )
417
- {
418
- // Arrange
419
- var requestDocument = new ResourcePostRequestDocument
420
- {
421
- Data = new ResourceDataInPostRequest
422
- {
423
- Attributes = _fakers . PostAttributes . Generate ( ) ,
424
- Relationships = new ResourceRelationshipsInPostRequest
425
- {
426
- ToOne = _fakers . NullableToOne . Generate ( ) ,
427
- RequiredToOne = _fakers . ToOne . Generate ( ) ,
428
- ToMany = _fakers . ToMany . Generate ( ) ,
429
- RequiredToMany = _fakers . ToMany . Generate ( )
430
- }
431
- }
432
- } ;
433
-
434
- SetPropertyToInitialValue ( requestDocument . Data . Relationships , relationshipPropertyName ) ;
435
-
436
- using var wrapper = FakeHttpClientWrapper . Create ( HttpStatusCode . NoContent , null ) ;
437
- var apiClient = new NrtOffMsvOnClient ( wrapper . HttpClient ) ;
438
-
439
- using IDisposable _ = apiClient . WithPartialAttributeSerialization < ResourcePostRequestDocument , ResourceAttributesInPostRequest > ( requestDocument ) ;
440
-
441
- // Act
442
- Func < Task < ResourcePrimaryResponseDocument ? > > action = async ( ) => await apiClient . PostResourceAsync ( requestDocument ) ;
443
-
444
- // Assert
445
- ExceptionAssertions < JsonSerializationException > assertion = await action . Should ( ) . ThrowExactlyAsync < JsonSerializationException > ( ) ;
446
-
447
- assertion . Which . Message . Should ( ) . Be (
448
- $ "Cannot write a null value for property 'id'. Property requires a value. Path 'data.relationships.{ jsonPropertyName } .data'.") ;
449
- }
450
-
451
- [ Theory ]
452
- [ InlineData ( nameof ( ResourceRelationshipsInPostRequest . RequiredToOne ) , "requiredToOne" ) ]
453
- public async Task Cannot_omit_relationship_without_partial_attribute_serialization ( string relationshipPropertyName , string jsonPropertyName )
297
+ public async Task Cannot_omit_relationship ( string relationshipPropertyName , string jsonPropertyName )
454
298
{
455
299
// Arrange
456
300
var requestDocument = new ResourcePostRequestDocument
0 commit comments