public void GivenFilterParameters_When_QueryConstraintsMethodInvoked_ShouldReturnQueryConstaintsWithCorrectState() { var filterParameters = new FilterParameters { AvailabilityId = 1 }; QueryConstraints constraints = filterParameters.GetQueryConstraints() as QueryConstraints; Assert.AreEqual(constraints.GetSortParameterString(), "ASC"); Assert.AreEqual(constraints.SortPropertyName, "name"); Assert.AreEqual(1, (int)constraints.FilterParameters.Single(p => p.Key == "availableId").Value); }
public async Task <ActionResult> Index(FilterParameters parameters) { var viewModel = new HomePageViewModel { Page = 1, Availabilities = await beerAvailibilityMenuRepository.GetMenu(), Glasswares = await glassMenuRepository.GetMenu(), Styles = await styleMenuRepository.GetMenu(), Beers = await beerRepository.GetBeers(parameters.GetQueryConstraints()), }; return(View(viewModel)); }