public async Task ShouldReturnModelList() { //Arrange var vehicleModels = new List <IVehicleModel>() { new VehicleModel() { Id = 1, Name = "123", Abrv = "Mercedes", MakeId = 1 }, new VehicleModel() { Id = 2, Name = "A5", Abrv = "Audi", MakeId = 2 }, }.AsEnumerable(); string searchString = ""; string sortBy = ""; int page = 0; VehicleFilters filters = new VehicleFilters(searchString); VehicleSorting sorting = new VehicleSorting(sortBy); VehiclePaging paging = new VehiclePaging(page); _modelRepoMock.Setup(x => x.GetAll(filters, sorting, paging)).Returns(Task.FromResult(vehicleModels)); //Act var result = await _sut.GetVehicleModels(filters, sorting, paging); //Assert result.Should().BeEquivalentTo(vehicleModels); }
// GET: VehicleModels public ActionResult Index(string sortBy, int?filter, int?page) { // Get vehicle makes IEnumerable <VehicleModel> vehicleModels = vehicleModelLogic.GetVehicleModels(filter, page, sortBy); // Put data in ViewBag ViewBag.sortBy = sortBy; ViewBag.filter = filter; ViewBag.Makes = new SelectList(vehicleMakeLogic.GetVehicleMakes(), "Id", "Name"); IEnumerable <VehicleModelViewModel> vehicleModelsVM = Mapper.Map <IEnumerable <VehicleModelViewModel> >(vehicleModels); return(View("~/Views/Admin/VehicleModels/Index.cshtml", vehicleModelsVM)); }