public async Task Add_update_delete_query_throws_if_no_container() { await using var testDatabase = CosmosTestStore.CreateInitialized(DatabaseName + "Empty"); var options = Fixture.CreateOptions(testDatabase); var customer = new Customer { Id = 42, Name = "Theon" }; using (var context = new CustomerContext(options)) { context.Add(customer); Assert.StartsWith(CosmosStrings.CreateItemFailed("NotFound", "Message: {\"Errors\":[\"Resource Not Found\"]}")[..^ 1], (await Assert.ThrowsAsync <InvalidOperationException>(() => context.SaveChangesAsync())).Message); } using (var context = new CustomerContext(options)) { context.Add(customer).State = EntityState.Modified; Assert.StartsWith(CosmosStrings.ReplaceItemFailed("NotFound", "Message: {\"Errors\":[\"Resource Not Found\"]}")[..^ 1], (await Assert.ThrowsAsync <InvalidOperationException>(() => context.SaveChangesAsync())).Message); } using (var context = new CustomerContext(options)) { context.Add(customer).State = EntityState.Deleted; Assert.StartsWith(CosmosStrings.DeleteItemFailed("NotFound", "Message: {\"Errors\":[\"Resource Not Found\"]}")[..^ 1], (await Assert.ThrowsAsync <InvalidOperationException>(() => context.SaveChangesAsync())).Message); } using (var context = new CustomerContext(options)) { Assert.StartsWith(CosmosStrings.QueryFailed("NotFound", "Message: {\"Errors\":[\"Resource Not Found\"]}")[..^ 1], (await Assert.ThrowsAsync <InvalidOperationException>(() => context.Set <Customer>().SingleAsync())).Message); } }