public async Task Cannot_replace_for_unknown_IDs_in_data() { // Arrange RecordCompany existingCompany = _fakers.RecordCompany.Generate(); Guid[] trackIds = ArrayFactory.Create(Guid.NewGuid(), Guid.NewGuid()); await _testContext.RunOnDatabaseAsync(async dbContext => { dbContext.RecordCompanies.Add(existingCompany); await dbContext.SaveChangesAsync(); }); var requestBody = new { atomic__operations = new[] { new { op = "update", @ref = new { type = "recordCompanies", id = existingCompany.StringId, relationship = "tracks" }, data = new[] { new { type = "musicTracks", id = trackIds[0].ToString() }, new { type = "musicTracks", id = trackIds[1].ToString() } } } } }; const string route = "/operations"; // Act (HttpResponseMessage httpResponse, ErrorDocument responseDocument) = await _testContext.ExecutePostAtomicAsync <ErrorDocument>(route, requestBody); // Assert httpResponse.Should().HaveStatusCode(HttpStatusCode.NotFound); responseDocument.Errors.Should().HaveCount(2); Error error1 = responseDocument.Errors[0]; error1.StatusCode.Should().Be(HttpStatusCode.NotFound); error1.Title.Should().Be("A related resource does not exist."); error1.Detail.Should().Be($"Related resource of type 'musicTracks' with ID '{trackIds[0]}' in relationship 'tracks' does not exist."); error1.Source.Pointer.Should().Be("/atomic:operations[0]"); Error error2 = responseDocument.Errors[1]; error2.StatusCode.Should().Be(HttpStatusCode.NotFound); error2.Title.Should().Be("A related resource does not exist."); error2.Detail.Should().Be($"Related resource of type 'musicTracks' with ID '{trackIds[1]}' in relationship 'tracks' does not exist."); error2.Source.Pointer.Should().Be("/atomic:operations[0]"); }