File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
test/JsonApiDotNetCoreTests/IntegrationTests/Meta Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -365,6 +365,53 @@ public async Task Accepts_top_level_meta_in_atomic_add_resource_operation()
365365 ValidateMetaData ( store . Document . Meta ) ;
366366 }
367367
368+ [ Fact ]
369+ public async Task Accepts_top_level_meta_in_atomic_remove_resource_operation ( )
370+ {
371+ // Arrange
372+ var store = _testContext . Factory . Services . GetRequiredService < RequestDocumentStore > ( ) ;
373+
374+ SupportTicket existingTicket = _fakers . SupportTicket . GenerateOne ( ) ;
375+
376+ await _testContext . RunOnDatabaseAsync ( async dbContext =>
377+ {
378+ dbContext . SupportTickets . Add ( existingTicket ) ;
379+ await dbContext . SaveChangesAsync ( ) ;
380+ } ) ;
381+
382+ var requestBody = new
383+ {
384+ atomic__operations = new [ ]
385+ {
386+ new
387+ {
388+ op = "remove" ,
389+ @ref = new
390+ {
391+ type = "supportTickets" ,
392+ id = existingTicket . StringId
393+ }
394+ }
395+ } ,
396+ meta = GetExampleMetaData ( )
397+ } ;
398+
399+ string route = $ "/operations";
400+
401+ // Act
402+ ( HttpResponseMessage httpResponse , string responseDocument ) = await _testContext . ExecutePostAtomicAsync < string > ( route , requestBody ) ;
403+
404+ // Assert
405+ httpResponse . ShouldHaveStatusCode ( HttpStatusCode . NoContent ) ;
406+
407+ responseDocument . Should ( ) . BeEmpty ( ) ;
408+
409+ store . Document . Should ( ) . NotBeNull ( ) ;
410+ store . Document . Meta . Should ( ) . NotBeNull ( ) ;
411+
412+ ValidateMetaData ( store . Document . Meta ) ;
413+ }
414+
368415 private static Object GetExampleMetaData ( )
369416 {
370417 return new
You can’t perform that action at this time.
0 commit comments