public void GetCustomerByEmailShouldGet() { var options = new DbContextOptionsBuilder <SoilMatesContext>().UseInMemoryDatabase("GetCustomerByEmailShouldGet").Options; using var testContext = new SoilMatesContext(options); seed(testContext); using var assertContext = new SoilMatesContext(options); repo = new DBrepo(assertContext); var result = repo.GetCustomerByEmail("*****@*****.**"); Assert.NotNull(result); Assert.Equal("Will", result.Name); }
public void GetLocationByIdShouldGet() { var options = new DbContextOptionsBuilder <SoilMatesContext>().UseInMemoryDatabase("GetLocationByIdShouldGet").Options; using var testContext = new SoilMatesContext(options); seed(testContext); using var assertContext = new SoilMatesContext(options); repo = new DBrepo(assertContext); var result = repo.GetLocationById(3); Assert.NotNull(result); Assert.Equal("FlowerMates", result.Name); }
public void AddOrderShouldAdd() { //arrange var options = new DbContextOptionsBuilder <SoilMatesContext>().UseInMemoryDatabase("AddOrderShoudAdd").Options; using var testContext = new SoilMatesContext(options); repo = new DBrepo(testContext); //act repo.AddOrder(testOrder); //assert using var assertContext = new SoilMatesContext(options); Assert.NotNull(assertContext.Orders.SingleAsync(n => n.OrderId == testOrder.OrderId)); }
public void AddProductShouldAdd() { //arrange var options = new DbContextOptionsBuilder <SoilMatesContext>().UseInMemoryDatabase("AddProductShoudAdd").Options; using var testContext = new SoilMatesContext(options); repo = new DBrepo(testContext); //act repo.AddProduct(testProduct); //assert using var assertContext = new SoilMatesContext(options); Assert.NotNull(assertContext.Products.SingleAsync(n => n.Name == testProduct.Name)); }
public void AddLocationShouldAdd() { //arrange var options = new DbContextOptionsBuilder <SoilMatesContext>().UseInMemoryDatabase("AddLocationShoudAdd").Options; using var testContext = new SoilMatesContext(options); repo = new DBrepo(testContext); //act repo.AddLocation(testLocation); //assert using var assertContext = new SoilMatesContext(options); Assert.NotNull(assertContext.Inventories.SingleAsync(n => n.InventoryId == testInventory.InventoryId)); }