public void TestLocationLineCreation() { var options = new DbContextOptionsBuilder <P0_DbContext>() .UseInMemoryDatabase(databaseName: "TestDb") .Options; using (var context = new P0_DbContext(options)) { context.Add(new LocationLine(1, 1, 1, 1)); context.SaveChanges(); } using (var context = new P0_DbContext(options)) { var locationLine = context.locationLines.SingleOrDefault(x => x.LocationLineId == 1); Assert.Equal(1, 1); } }
public void TestLocationCreation() { var options = new DbContextOptionsBuilder <P0_DbContext>() .UseInMemoryDatabase(databaseName: "TestDb") .Options; using (var context = new P0_DbContext(options)) { context.Add(new Location("Test", "Test", "Test", "Test")); context.SaveChanges(); } using (var context = new P0_DbContext(options)) { var location = context.locations.SingleOrDefault(x => x.Address == "Test").Address; Assert.Equal("Test", location); } }
public void TestOrderCreation() { var options = new DbContextOptionsBuilder <P0_DbContext>() .UseInMemoryDatabase(databaseName: "TestDb") .Options; using (var context = new P0_DbContext(options)) { context.Add(new Order(1, 1, DateTime.Now, 1)); context.SaveChanges(); } using (var context = new P0_DbContext(options)) { var order = context.orders.SingleOrDefault(x => x.OrderId == 1); Assert.Equal(1, 1); } }
public void TestCustomerCreation() { var options = new DbContextOptionsBuilder <P0_DbContext>() .UseInMemoryDatabase(databaseName: "TestDb") .Options; using (var context = new P0_DbContext(options)) { context.Add(new Customer("Test", "Best")); context.SaveChanges(); } using (var context = new P0_DbContext(options)) { var customer = context.customers.SingleOrDefault(x => x.FirstName == "Test").FirstName; Assert.Equal("Test", customer); } }