File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
test/JsonApiDotNetCoreTests/IntegrationTests/Meta Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -506,6 +506,55 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
506506 ValidateMetaData ( relationship . Meta ) ;
507507 }
508508
509+ [ Fact ]
510+ public async Task Accepts_meta_in_data_of_atomic_add_resource_operation ( )
511+ {
512+ // Arrange
513+ var store = _testContext . Factory . Services . GetRequiredService < RequestDocumentStore > ( ) ;
514+
515+ SupportTicket existingTicket = _fakers . SupportTicket . GenerateOne ( ) ;
516+
517+ var requestBody = new
518+ {
519+ atomic__operations = new [ ]
520+ {
521+ new
522+ {
523+ op = "add" ,
524+ data = new
525+ {
526+ type = "supportTickets" ,
527+ attributes = new
528+ {
529+ description = existingTicket . Description
530+ } ,
531+ meta = GetExampleMetaData ( )
532+ }
533+ }
534+ }
535+ } ;
536+
537+ string route = $ "/operations";
538+
539+ // Act
540+ ( HttpResponseMessage httpResponse , _ ) = await _testContext . ExecutePostAtomicAsync < Document > ( route , requestBody ) ;
541+
542+ // Assert
543+ httpResponse . ShouldHaveStatusCode ( HttpStatusCode . OK ) ;
544+
545+ store . Document . Should ( ) . NotBeNull ( ) ;
546+ store . Document . Operations . Should ( ) . NotBeNull ( ) ;
547+ store . Document . Operations . Should ( ) . HaveCount ( 1 ) ;
548+
549+ var operation = store . Document . Operations [ 0 ] ;
550+ operation . Should ( ) . NotBeNull ( ) ;
551+ operation . Data . Should ( ) . NotBeNull ( ) ;
552+ operation . Data . SingleValue . Should ( ) . NotBeNull ( ) ;
553+ operation . Data . SingleValue . Meta . Should ( ) . NotBeNull ( ) ;
554+
555+ ValidateMetaData ( operation . Data . SingleValue . Meta ) ;
556+ }
557+
509558 private static Object GetExampleMetaData ( )
510559 {
511560 return new
You can’t perform that action at this time.
0 commit comments