Beispiel #1
0
        /// <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);
        }
Beispiel #2
0
        public void UpdateCreateSalesReportBLLISalesReprotInfoTest()
        {
            //Arrange
            UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL();
            OfficeStoreContext         officeStoreContext         = new OfficeStoreContext();

            //Act
            List <DailySales> Items = updateCreateSalesReportBLL.SalesReprotInfo();

            //Assert
            Assert.IsNotNull(Items);
        }
Beispiel #3
0
        public void UpdateCreateSalesReportBLLIsItemExistsTest2()
        {
            //Arrange
            UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL();
            OfficeStoreContext         officeStoreContext         = new OfficeStoreContext();

            //Act
            bool IsItemExists = updateCreateSalesReportBLL.IsItemExists("1212121212");

            //Assert
            Assert.IsFalse(IsItemExists);
        }
Beispiel #4
0
        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();
        }
Beispiel #5
0
        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]);
        }
Beispiel #6
0
        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();
        }
Beispiel #7
0
        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();
        }
Beispiel #8
0
        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();
        }
Beispiel #9
0
        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);
        }
Beispiel #10
0
 public RegisterLoginInfoBLL()
 {
     this.officestoreContext = new OfficeStoreContext();
 }
Beispiel #11
0
 public RegisterLoginInfoBLL(OfficeStoreContext context)
 {
     this.officestoreContext = context;
 }
 public ProductsController(OfficeStoreContext context)
 {
     _context = context;
 }
Beispiel #13
0
 public InvoiceBLL(OfficeStoreContext mockcontex)
 {
     this.officeStoreContext = mockcontex;
 }
Beispiel #14
0
 public InvoiceBLL()
 {
     this.officeStoreContext = new OfficeStoreContext();
 }
Beispiel #15
0
 public UpdateCreateSalesReportBLL(OfficeStoreContext MockContext)
 {
     this.officeStoreContext = MockContext;
 }
Beispiel #16
0
 public UpdateCreateSalesReportBLL()
 {
     this.officeStoreContext = new OfficeStoreContext();
 }