Ejemplo n.º 1
0
        public void GetSuggestionsActionTest()
        {
            CityRepository  cityRepository  = mockRepository.DynamicMock <CityRepository>();
            PlaceRepository placeRepository = mockRepository.DynamicMock <PlaceRepository>();

            using (mockRepository.Record())
            {
                SetupResult.For(cityRepository.GetCitiesIdAndNames()).IgnoreArguments().Return(cities);
                SetupResult.For(placeRepository.GetPlacesIdsAndNames()).IgnoreArguments().Return(places);
            }

            SearchController searchController = new SearchController(cityRepository, placeRepository);

            using (mockRepository.Playback())
            {
                var suggestions = searchController.GetSuggestions("1");
                Assert.That(suggestions, Is.TypeOf <OkNegotiatedContentResult <IList <ISearchEntity> > >());
            }
        }