Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
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);
        }