public async Task Returns_MatchLocationsViewModel_from_builder()
        {
            var model = new MatchLocationsViewModel(Mock.Of <IPublishedContent>(), Mock.Of <IUserService>())
            {
                Filter = new MatchLocationFilter()
            };
            var dataSource      = new Mock <IMatchLocationDataSource>();
            var listingsBuilder = new Mock <IListingsModelBuilder <MatchLocation, MatchLocationFilter, MatchLocationsViewModel> >();

            listingsBuilder.Setup(x => x.BuildModel(
                                      It.IsAny <Func <MatchLocationsViewModel> >(),
                                      dataSource.Object.ReadTotalMatchLocations,
                                      dataSource.Object.ReadMatchLocations,
                                      Constants.Pages.MatchLocations,
                                      _pageUrl,
                                      _queryString
                                      )).Returns(Task.FromResult(model));

            using (var controller = CreateController(dataSource.Object, listingsBuilder.Object))
            {
                var result = await controller.Index(new ContentModel(Mock.Of <IPublishedContent>())).ConfigureAwait(false);

                listingsBuilder.Verify(x => x.BuildModel(
                                           It.IsAny <Func <MatchLocationsViewModel> >(),
                                           dataSource.Object.ReadTotalMatchLocations,
                                           dataSource.Object.ReadMatchLocations,
                                           Constants.Pages.MatchLocations,
                                           _pageUrl,
                                           _queryString
                                           ), Times.Once);
                Assert.Equal(model, ((ViewResult)result).Model);
            }
        }
        public async Task Index_sets_TeamTypes_filter()
        {
            MatchLocationsViewModel model = null;
            var dataSource      = new Mock <IMatchLocationDataSource>();
            var listingsBuilder = new Mock <IListingsModelBuilder <MatchLocation, MatchLocationFilter, MatchLocationsViewModel> >();

            listingsBuilder.Setup(x => x.BuildModel(
                                      It.IsAny <Func <MatchLocationsViewModel> >(),
                                      dataSource.Object.ReadTotalMatchLocations,
                                      dataSource.Object.ReadMatchLocations,
                                      Constants.Pages.MatchLocations,
                                      _pageUrl,
                                      _queryString
                                      ))
            .Callback <Func <MatchLocationsViewModel>, Func <MatchLocationFilter, Task <int> >, Func <MatchLocationFilter, Task <List <MatchLocation> > >, string, Uri, NameValueCollection>(
                (buildInitialState, totalListings, listings, pageTitle, pageUrl, queryParameters) =>
            {
                model = buildInitialState();
            }
                );

            using (var controller = CreateController(dataSource.Object, listingsBuilder.Object))
            {
                var result = await controller.Index(new ContentModel(Mock.Of <IPublishedContent>())).ConfigureAwait(false);

                Assert.True(model.Filter.TeamTypes.Any());
            }
        }