Пример #1
0
        public void GetVehicles_InputValidList_ReturnCount()
        {
            //Arrange

            //Act
            var result = _blSale.GetVehicles(_dummySales);

            //Assert
            Assert.That(result.Count(), Is.EqualTo(6));
        }
        public ActionResult Index(HttpPostedFileBase postedFile)
        {
            _sales = _blSale.GetSales(postedFile.InputStream);

            if (_sales != null)
            {
                if (_sales.Count() > 0)
                {
                    ViewData["MostOftenVehicle"] = _sales
                                                   .GroupBy(x => x.Vehicle)
                                                   .OrderByDescending(d => d.Count())
                                                   .Select(a => a.Key)
                                                   .FirstOrDefault();
                    ViewData["Sales"]            = _sales;
                    ViewData["MonthPrice"]       = _blSale.GetMonthPrices(_sales);
                    ViewData["MonthSale"]        = _blSale.GetMonthSales(_sales);
                    ViewData["DealerSale"]       = _blSale.GetDealerSales(_sales);
                    ViewData["MonthVehicleSale"] = _blSale.GetMonthVehicleSales(_sales);
                    ViewData["Vehicles"]         = _blSale.GetVehicles(_sales);
                    ViewData["DealerMonthSales"] = _blSale.GetMonthDealerSales(_sales);
                    ViewData["Dealers"]          = _blSale.GetDealers(_sales);
                }
                else
                {
                    ViewData["Message"] = "There are no records in the CSV file. Please upload a file with Vehicle Sales.";
                }
            }
            else
            {
                ViewData["Message"] = "There are errors in the CSV file. Please Correct it and Re-Upload.";
            }
            return(View(_sales));
        }