public void GetCurrentWeather_Given_AnyCountryAndCity_Returns_DummyWeather() { //arrange var sut = new DummyWeatherService(); //act var dummyWeather = sut.GetCurrentWeather(Arg.Any <string>(), Arg.Any <string>()); //assert //DummyWeatherService always returns the same Weather dummyWeather.Temperature.Format.ShouldBe("Celcius"); dummyWeather.Temperature.Value.ShouldBe(16); dummyWeather.Humidity.ShouldBe(88); }
public void Get_Given_AnyCountryAndCity_Returns_WeatherModel() { //arrange Mapper.Initialize(Mappings.CreateMappings); var dummyExternalWeatherService = new DummyWeatherService(); var weatherService = new WeatherService(dummyExternalWeatherService); var sut = new WeatherController(weatherService, new DefaultMapper()) { Request = new HttpRequestMessage(), Configuration = new HttpConfiguration() }; var dummyWeather = dummyExternalWeatherService.GetCurrentWeather(Arg.Any <string>(), Arg.Any <string>()); //act var weatherModel = sut.Get(Arg.Any <string>(), Arg.Any <string>()); //assert //DummyWeatherService always returns the same weather weatherModel.Temperature.Value.ShouldBe(dummyWeather.Temperature.Value); weatherModel.Temperature.Format.ShouldBe(dummyWeather.Temperature.Format); weatherModel.Humidity.ShouldBe(dummyWeather.Humidity); }