Ejemplo n.º 1
0
        public void SampleDataCanSearchSalesForReportReturnNullList()
        {
            var repo   = new SalesRepositorySampleData();
            var report = repo.GetSalesForReport(new SalesReportSearchParameters {
                ToDate = "12/1/2017"
            }).ToList();

            Assert.AreEqual(0, report.Count());
        }
Ejemplo n.º 2
0
        public void SampleDataCanSearchSalesForReportNoParams()
        {
            var repo   = new SalesRepositorySampleData();
            var report = repo.GetSalesForReport(new SalesReportSearchParameters {
            }).ToList();

            Assert.AreEqual(235000M, report[0].TotalSales);
            Assert.AreEqual(5, report[0].TotalVehicles);
        }
Ejemplo n.º 3
0
        public void SampleDataCanSearchSalesForReportBogusDate()
        {
            var repo   = new SalesRepositorySampleData();
            var report = repo.GetSalesForReport(new SalesReportSearchParameters {
                ToDate = "bbbb", FromDate = "mmmm"
            }).ToList();

            Assert.AreEqual(235000M, report[0].TotalSales);
            Assert.AreEqual(5, report[0].TotalVehicles);
        }
Ejemplo n.º 4
0
        public void SampleDataCanSearchSalesForReportAllParams()
        {
            var repo   = new SalesRepositorySampleData();
            var report = repo.GetSalesForReport(new SalesReportSearchParameters {
                ToDate = "12/31/2017", FromDate = "1-1-2017", UserId = "33333333-3333-3333-3333-333333333333"
            }).ToList();

            Assert.AreEqual(30000M, report[0].TotalSales);
            Assert.AreEqual(1, report[0].TotalVehicles);
        }
Ejemplo n.º 5
0
        public void SampleDataCanSearchSalesForReportForTwoParameters()
        {
            var repo   = new SalesRepositorySampleData();
            var report = repo.GetSalesForReport(new SalesReportSearchParameters {
                ToDate = "05/1/2018", UserId = "11111111-1111-1111-1111-111111111111"
            }).ToList();

            Assert.AreEqual(10500M, report[0].TotalSales);
            Assert.AreEqual(1, report[0].TotalVehicles);

            report = repo.GetSalesForReport(new SalesReportSearchParameters {
                FromDate = "05/1/2018", UserId = "11111111-1111-1111-1111-111111111111"
            }).ToList();

            Assert.AreEqual(123400.51M, report[0].TotalSales);
            Assert.AreEqual(4, report[0].TotalVehicles);

            report = repo.GetSalesForReport(new SalesReportSearchParameters {
                ToDate = "06/30/2018", FromDate = "5-1-2018"
            }).ToList();

            Assert.AreEqual(99500M, report[0].TotalSales);
            Assert.AreEqual(2, report[0].TotalVehicles);
        }
Ejemplo n.º 6
0
        public void SampleDataCanSearchSalesForReportOneParameter()
        {
            var repo   = new SalesRepositorySampleData();
            var report = repo.GetSalesForReport(new SalesReportSearchParameters {
                UserId = "22222222-2222-2222-2222-222222222222"
            }).ToList();

            Assert.AreEqual(110000M, report[0].TotalSales);
            Assert.AreEqual(4, report[0].TotalVehicles);

            report = repo.GetSalesForReport(new SalesReportSearchParameters {
                FromDate = "04/01/2018"
            }).ToList();

            Assert.AreEqual(133900.51M, report[0].TotalSales);
            Assert.AreEqual(5, report[0].TotalVehicles);

            report = repo.GetSalesForReport(new SalesReportSearchParameters {
                ToDate = "04/01/2018"
            }).ToList();

            Assert.AreEqual(132000M, report[0].TotalSales);
            Assert.AreEqual(3, report[0].TotalVehicles);
        }