Exemplo n.º 1
0
        public void WeeklySalesTest()
        {
            FakeSaleRepository repository = new FakeSaleRepository();

            var s = new Sale()
            {
                SaleTotal = 25, SaleDate = DateTime.Today
            };
            var s1 = new Sale()
            {
                SaleTotal = 50, SaleDate = DateTime.Today
            };
            var s2 = new Sale()
            {
                SaleTotal = 25, SaleDate = DateTime.Today
            };
            //repository.AddSale(s);
            //repository.AddSale(s1);
            //repository.AddSale(s2);

            //SalesController controller = new SalesController(repository);
            //var thisMonthTotal = controller.WeeklyTotal();

            //Assert.Equal(100, thisMonthTotal);
        }
Exemplo n.º 2
0
        public void GetAllRepsWeeklySalesTest()
        {
            //NOTE: Testing controller method
            FakeSaleRepository repository = new FakeSaleRepository();

            var s = new Sale()
            {
                SaleTotal = 25, SaleDate = new DateTime(2017, 05, 22)
            };
            var s1 = new Sale()
            {
                SaleTotal = 50, SaleDate = new DateTime(2017, 05, 23)
            };
            var s2 = new Sale()
            {
                SaleTotal = 25, SaleDate = new DateTime(2017, 05, 24)
            };
            //repository.AddSale(s);
            //repository.AddSale(s1);
            //repository.AddSale(s2);

            //SalesController controller = new SalesController(repository);
            //var weekTotal = controller.GetAllRepsWeeklySales(new DateTime(2017, 05, 24));

            //Assert.Equal(100, weekTotal);
        }
Exemplo n.º 3
0
        public void GetLastYearThisMonthSalesTest()
        {
            FakeSaleRepository repository = new FakeSaleRepository();

            var s = new Sale()
            {
                SaleTotal = 25, SaleDate = new DateTime(2017, 05, 22)
            };
            var s1 = new Sale()
            {
                SaleTotal = 50, SaleDate = new DateTime(2017, 05, 23)
            };
            var s2 = new Sale()
            {
                SaleTotal = 25, SaleDate = new DateTime(2017, 05, 24)
            };
            //repository.AddSale(s);
            //repository.AddSale(s1);
            //repository.AddSale(s2);

            //SalesController controller = new SalesController(repository);
            //var lastYearMonthTotal = controller.GetLastYearThisMonthSalesTotal(new DateTime(2018, 05, 24));

            //Assert.Equal(100, lastYearMonthTotal);
        }
Exemplo n.º 4
0
        public void GetAllRepsDailySalesTest()
        {
            FakeSaleRepository repository = new FakeSaleRepository();
            var s = new Sale()
            {
                SaleTotal = 400, SaleDate = DateTime.Today
            };
            //repository.AddSale(s);
            var s1 = new Sale()
            {
                SaleTotal = 50, SaleDate = DateTime.Today
            };
            //repository.AddSale(s1);
            var s2 = new Sale()
            {
                SaleTotal = 25, SaleDate = DateTime.Today
            };
            //repository.AddSale(s2);

            //SalesController controller = new SalesController(repository);
            //var todayTotal = controller.GetAllRepsDailySales(DateTime.Today);

            //Assert.Equal(475, todayTotal);

            // Test passed above. Writing this next code to ensure that it is only claculating TODAYS sales.
            var s3 = new Sale()
            {
                SaleTotal = 1000, SaleDate = new DateTime(2018, 05, 02)
            };
            //repository.AddSale(s3);

            //Assert.Equal(475, todayTotal);
        }
Exemplo n.º 5
0
        public void GetSalesByDateRangeTest()
        {
            FakeSaleRepository repository = new FakeSaleRepository();
            var s = new Sale()
            {
                SaleTotal = 25, SaleDate = new DateTime(2017, 05, 01)
            };
            var s1 = new Sale()
            {
                SaleTotal = 50, SaleDate = new DateTime(2017, 05, 01)
            };
            var s2 = new Sale()
            {
                SaleTotal = 25, SaleDate = new DateTime(2017, 05, 24)
            };
            //repository.AddSale(s);
            //repository.AddSale(s1);
            //repository.AddSale(s2);

            //SalesController controller = new SalesController(repository);

            var day  = new DateTime(2017, 05, 01);
            var day2 = new DateTime(2017, 05, 31);
            //List<Sale> l = controller.GetSalesByDateRange(day, day2);

            //Assert.Equal(25, l[0].SaleTotal);
        }
Exemplo n.º 6
0
        public void GetSaleByIdTest()
        {
            FakeSaleRepository repository = new FakeSaleRepository();
            Sale s = repository.GetSaleById(222);

            Assert.Equal(200, s.SaleTotal);
        }
Exemplo n.º 7
0
        public void GetAllSalesTest()
        {
            FakeSaleRepository repository = new FakeSaleRepository();
            var saleList = repository.GetAllSales();

            Assert.Equal(3, saleList.Count);
            Assert.Equal(100, saleList[0].SaleTotal);
            Assert.Equal(200, saleList[1].SaleTotal);
            Assert.Equal(300, saleList[2].SaleTotal);
        }
Exemplo n.º 8
0
        public void AddSaleTest()
        {
            FakeSaleRepository repository = new FakeSaleRepository();
            var s = new Sale()
            {
                SaleTotal = 400
            };

            //repository.AddSale(s);
            Assert.Equal(400, repository.GetAllSales()[0].SaleTotal);
        }