public async Task WeatherService_WhenGetByValidCityName_MustBeReturnWeather() { //Arrange var httpClient = new Mock <HttpClient>(); var service = new OpenWeatherService(httpClient.Object, _options, _weatherRepository, _mediatorHandler); //Act var response = await service.GetTemperatureByCityName(cityName : "Morrinhos"); //Assert Assert.NotNull(response); Assert.Equal("Morrinhos", response?.Name); }
public async Task WeatherService_WhenGetByInValidCityName_MustBeReturnNotification() { //Arrange var httpClient = new Mock <HttpClient>(); var service = new OpenWeatherService(httpClient.Object, _options, _weatherRepository, _mediatorHandler); //Act var response = await service.GetTemperatureByCityName(cityName : "InvalidCityName"); //Act, Assert Assert.Null(response); Assert.True(_notifications.HasNotifications()); Assert.Single(_notifications.GetNotifications()); }