Ejemplo n.º 1
0
        public async Task GetCarOverviewModelTest()
        {
            var car = CarDataSeeder.GetEntities().First();

            car.ShowCase = false;
            await _carRepository.AddAsync(car);

            car.Id       = 0;
            car.ShowCase = true;
            car.SaleDate = DateTime.Today.AddDays(-(ConfigurationConstants.RecentlySoldMaxDays + 1));
            await _carRepository.AddAsync(car);

            car.Id       = 0;
            car.ShowCase = false;
            car.SaleDate = DateTime.Today;
            await _carRepository.AddAsync(car);

            var carOverviewModel = await _carModelService.GetCarOverviewModelAsync();

            Assert.Single(carOverviewModel.CarsForSale);
            Assert.Single(carOverviewModel.CarsShowcase);
            Assert.Single(carOverviewModel.CarsRecentlySold);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            var carOverviewModel = await _carModelService.GetCarOverviewModelAsync();

            return(View(carOverviewModel));
        }