public void Can_use_non_persisted_properties() { using (var testDatabase = CosmosTestStore.CreateInitialized(DatabaseName)) { var options = Fixture.CreateOptions(testDatabase); var customer = new Customer { Id = 42, Name = "Theon" }; using (var context = new UnmappedCustomerContext(options)) { context.Database.EnsureCreated(); context.Add(customer); context.SaveChanges(); Assert.Equal("Theon", customer.Name); } using (var context = new UnmappedCustomerContext(options)) { var customerFromStore = context.Set <Customer>().Single(); Assert.Equal(42, customerFromStore.Id); Assert.Null(customerFromStore.Name); customerFromStore.Name = "Theon Greyjoy"; Assert.Equal(0, context.SaveChanges()); } } }
public async Task Can_use_non_persisted_properties() { var options = Fixture.CreateOptions(); var customer = new Customer { Id = 42, Name = "Theon" }; using (var context = new UnmappedCustomerContext(options)) { await context.Database.EnsureCreatedAsync(); context.Add(customer); await context.SaveChangesAsync(); Assert.Equal("Theon", customer.Name); } using (var context = new UnmappedCustomerContext(options)) { var customerFromStore = await context.Set <Customer>().SingleAsync(); Assert.Equal(42, customerFromStore.Id); Assert.Null(customerFromStore.Name); customerFromStore.Name = "Theon Greyjoy"; Assert.Equal(0, await context.SaveChangesAsync()); } }