public void UpdateCreateSalesReportBLLIsItemExistsTest() { //Arrange UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL(); OfficeStoreContext officeStoreContext = new OfficeStoreContext(); //Act updateCreateSalesReportBLL.CreateItem(new Items() { Id = "12", ProductName = "bira", Status = "Factory New", OriginalPrice = 1, SalesPrice = 2, Quantity = 12 }); bool IsItemExists = updateCreateSalesReportBLL.IsItemExists("12"); //Assert Assert.IsTrue(IsItemExists); officeStoreContext.Items.Remove(officeStoreContext.Items.First(a => a.ProductName == "bira")); officeStoreContext.SaveChanges(); }
public void UpdateCreateSalesReportBLLTest() { //Arrange UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL(); OfficeStoreContext officeStoreContext = new OfficeStoreContext(); //Act var InitialItemsCount = officeStoreContext.Items.Count(); updateCreateSalesReportBLL.CreateItem(new Items() { Id = "12", ProductName = "bira", Status = "Factory New", OriginalPrice = 1, SalesPrice = 2, Quantity = 12 }); var AfterInitialItemsCount = officeStoreContext.Items.Count(); //Assert Assert.AreEqual(InitialItemsCount + 1, AfterInitialItemsCount); officeStoreContext.Items.Remove(officeStoreContext.Items.First(a => a.ProductName == "bira")); officeStoreContext.SaveChanges(); }
public void UpdateCreateSalesReportBLLDeleteTest() { //Arrange UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL(); OfficeStoreContext officeStoreContext = new OfficeStoreContext(); //Act updateCreateSalesReportBLL.CreateItem(new Items() { Id = "12", ProductName = "bira", Status = "Factory New", OriginalPrice = 1, SalesPrice = 2, Quantity = 12 }); var AfterCreateItemCount = officeStoreContext.Items.Count(); updateCreateSalesReportBLL.Delete(officeStoreContext.Items.First(a => a.ProductName == "bira").Id); var AfterDeleteItemCount = officeStoreContext.Items.Count(); //Assert Assert.AreEqual(AfterCreateItemCount - 1, AfterDeleteItemCount); }