コード例 #1
0
        public void UpdateCreateSalesReportBLLClass()
        {
            //Arrange & Act
            UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL();

            //Assert
            Assert.IsNotNull(updateCreateSalesReportBLL);
        }
コード例 #2
0
 public SalesReportForm()
 {
     InitializeComponent();
     this.UpdateCreateSalesReport = new UpdateCreateSalesReportBLL();
     DailySalesReport();                                          //Updates the DataGrid
     DesignConfigurator();                                        //Improves The design of the DataGrid
     this.FormBorderStyle          = FormBorderStyle.FixedDialog; //Disables Resizing
     this.SalesReportComboBox.Text = this.SalesReportComboBox.Items[2].ToString();
     UpdateLabels();
 }
コード例 #3
0
 public StoreItemsForm()
 {
     InitializeComponent();
     this.UpdateCreateSalesReport = new UpdateCreateSalesReportBLL();
     UpdateGrid();
     //Updates the info of the DataGrid
     DesignConfigurator();
     //Improves the design of the DataGrid
     this.FormBorderStyle = FormBorderStyle.FixedDialog;//Disables Resizing
 }
コード例 #4
0
        public void UpdateCreateSalesReportBLLIsCheckedTest2()
        {
            //Arrange
            UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL();

            //Act
            bool IsChecked = updateCreateSalesReportBLL.IsChecked("Factory New");

            //Assert
            Assert.IsFalse(IsChecked);
        }
コード例 #5
0
        public void UpdateCreateSalesReportBLLIsCheckedTest1()
        {
            //Arrange
            UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL();

            //Act
            bool IsChecked = updateCreateSalesReportBLL.IsChecked("Second Hand");

            //Assert
            Assert.IsTrue(IsChecked);
        }
コード例 #6
0
        public void UpdateCreateSalesReportBLLStatusTextTest2()
        {
            //Arrange
            UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL();

            //Act
            string Text = updateCreateSalesReportBLL.StatusText(true);

            //Assert
            Assert.AreEqual("Second Hand", Text);
        }
コード例 #7
0
        public void UpdateCreateSalesReportBLLStatusTextTest()
        {
            //Arrange
            UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL();

            //Act
            string Text = updateCreateSalesReportBLL.StatusText(false);

            //Assert
            Assert.AreEqual("Factory New", Text);
        }
コード例 #8
0
        public void UpdateCreateSalesReportBLLISalesReprotInfoTest()
        {
            //Arrange
            UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL();
            OfficeStoreContext         officeStoreContext         = new OfficeStoreContext();

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

            //Assert
            Assert.IsNotNull(Items);
        }
コード例 #9
0
        public void UpdateCreateSalesReportBLLIsItemExistsTest2()
        {
            //Arrange
            UpdateCreateSalesReportBLL updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL();
            OfficeStoreContext         officeStoreContext         = new OfficeStoreContext();

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

            //Assert
            Assert.IsFalse(IsItemExists);
        }
コード例 #10
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();
        }
コード例 #11
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();
        }
コード例 #12
0
        public void UpdateCreateSalesReportBLLGenerateProfitOfTheDayTest()
        {
            //Arrange
            var data = new List <Items>
            {
                new Items()
                {
                    Id          = "1", Quantity = 12, OriginalPrice = 1, SalesPrice = 2,
                    ProductName = "Pen", Status = "Factory New"
                }
            }.AsQueryable();

            var mockSet = new Mock <DbSet <Items> >();

            mockSet.As <IQueryable <Items> >().Setup(m => m.Provider).Returns(data.Provider);
            mockSet.As <IQueryable <Items> >().Setup(m => m.Expression).Returns(data.Expression);
            mockSet.As <IQueryable <Items> >().Setup(m => m.ElementType).Returns(data.ElementType);
            mockSet.As <IQueryable <Items> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());

            var mockContext = new Mock <OfficeStoreContext>();

            mockContext.Setup(c => c.Items).Returns(mockSet.Object);

            var updateCreateSalesReportBLL = new UpdateCreateSalesReportBLL(mockContext.Object);
            var CartItem = new DailySales()
            {
                ProductNumber = "1", Quantity = 1, SinglePrice = 1
                , Description = "Item", Total = 1
            };
            var ItemsList = new List <DailySales>()
            {
                CartItem
            };

            //Act
            double ProfitOfTheDay = updateCreateSalesReportBLL.GenerateProfitOfTheDay(ItemsList);

            //Assert
            Assert.AreEqual(ProfitOfTheDay, 1);
        }
コード例 #13
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);
        }