/// <summary> /// Finds the Item from the database with the given Barcode /// and with that info create CartItem /// </summary> /// <param name="Barcode">Barcode of the Item selected by the client</param> /// <param name="Quantity">Quantity of the item selected by the client</param> public CartItem(string Barcode, string Quantity) { this.officestoreContext = new OfficeStoreContext(); var Item = this.officestoreContext.Items.First(a => a.Id == Barcode); this.Barcode = Barcode; this.Quantity = int.Parse(Quantity); this.SinglePrice = Math.Round(Item.SalesPrice, 2); this.Total = Math.Round(this.Quantity * this.SinglePrice, 2); }
public void UpdateCreateSalesReportBLLISalesReprotInfoTest() { //Arrange UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL(); OfficeStoreContext officeStoreContext = new OfficeStoreContext(); //Act List <DailySales> Items = updateCreateSalesReportBLL.SalesReprotInfo(); //Assert Assert.IsNotNull(Items); }
public void UpdateCreateSalesReportBLLIsItemExistsTest2() { //Arrange UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL(); OfficeStoreContext officeStoreContext = new OfficeStoreContext(); //Act bool IsItemExists = updateCreateSalesReportBLL.IsItemExists("1212121212"); //Assert Assert.IsFalse(IsItemExists); }
public void RegisterLoginInfoBLLSaveLoginedMethodTest() { //Arrange RegisterLoginInfoBLL registerLoginInfoBLL = new RegisterLoginInfoBLL(); OfficeStoreContext officeStoreContext = new OfficeStoreContext(); var InitialLaslLoginLoad = officeStoreContext.LastLogin.Last().Id; //Act registerLoginInfoBLL.SaveLogined("1"); var AfterInitialLaslLoginLoad = officeStoreContext.LastLogin.Last().Id; //Assert Assert.AreEqual(InitialLaslLoginLoad + 1, InitialLaslLoginLoad + 1); officeStoreContext.LastLogin.Remove(officeStoreContext.LastLogin.Last()); officeStoreContext.SaveChanges(); }
public void RegisterLoginInfoBLLSaveDataMethodTest() { //Arrange RegisterLoginInfoBLL registerLoginInfoBLL = new RegisterLoginInfoBLL(); OfficeStoreContext officeStoreContext = new OfficeStoreContext(); string[] NameAddress = registerLoginInfoBLL.GetNameAddressIfExists(); //Act registerLoginInfoBLL.SaveData("Test1", "Test2"); var StoreInfo = officeStoreContext.StoreInfo.First(); //Assert Assert.AreEqual(StoreInfo.Name, "Test1"); Assert.AreEqual(StoreInfo.Address, "Test2"); registerLoginInfoBLL.SaveData(NameAddress[0], NameAddress[1]); }
public void RegisterLoginInfoBLLRegisterTest() { //Arrange RegisterLoginInfoBLL registerLoginInfoBLL = new RegisterLoginInfoBLL(); OfficeStoreContext officeStoreContext = new OfficeStoreContext(); int InitialEmployeesCount = officeStoreContext.Employees.Count(); //Act registerLoginInfoBLL.Register("Barman", "Kavalov", "Sliven", "12345678"); int AfterInitialEmployeesCount = officeStoreContext.Employees.Count(); //Assert Assert.AreEqual(InitialEmployeesCount + 1, AfterInitialEmployeesCount); officeStoreContext.Employees.Remove(officeStoreContext.Employees.First(a => a.FirstName == "Barman")); officeStoreContext.SaveChanges(); }
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); }
public RegisterLoginInfoBLL() { this.officestoreContext = new OfficeStoreContext(); }
public RegisterLoginInfoBLL(OfficeStoreContext context) { this.officestoreContext = context; }
public ProductsController(OfficeStoreContext context) { _context = context; }
public InvoiceBLL(OfficeStoreContext mockcontex) { this.officeStoreContext = mockcontex; }
public InvoiceBLL() { this.officeStoreContext = new OfficeStoreContext(); }
public UpdateCreateSalesReportBLL(OfficeStoreContext MockContext) { this.officeStoreContext = MockContext; }
public UpdateCreateSalesReportBLL() { this.officeStoreContext = new OfficeStoreContext(); }