private void BeforeScenario() { _exampleCityEntities = new List <City>(); _mapperService = new MapperService(); _mockUnitOfWork = new Mock <IUnitOfWork>(); _mockUnitOfWork.Setup(x => x.Complete()).Verifiable(); _mockCityRepository = new Mock <IRepository <CityWeatherContainer, City> >(); _mockCityRepository.Setup(x => x.Read()).Returns(_exampleCityEntities); /* todo: check if this would be okay for the specs. * thought about mocking this, but I don't think a quick REST call is a problem here; * besides specs can be longer running tests that also test integration unlike unit tests. * if the 3rd party API changed and broke our system it would be nice to know about it. * assuming the tests will be run on a machine with an internet connection. :/ * in reality I'd check this with the client. */ _countryService = new CountryRestService(); _weatherService = new WeatherRestService(); _cityDataService = new CityDataService(_mockCityRepository.Object, _mockUnitOfWork.Object, _mapperService); _citySearchDomainService = new CitySearchDomainService(_mapperService, _cityDataService, _weatherService, _countryService); _citySearchController = new CitySearchController(_mapperService, _citySearchDomainService); }
public WeatherPage() { InitializeComponent(); _restService = new WeatherRestService(); }