public async Task ForecastCountShouldBeFour() { HttpMessageHandler handlerMock = MockHttpMessageHandler.CreateMock( new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent( FromEmbedResources.ReadText("ResponseMock.ForecastResponse.json")) }); var httpClient = new HttpClient(handlerMock); IWeatherService weatherService = new WeatherService(httpClient, ""); WeatherViewModel weatherViewModelMock = MockWeatherViewModel.CreateMock(weatherService).Object; await weatherViewModelMock.GetForecastAsync(); weatherViewModelMock.Forecast.Should().HaveCount(5); }
public async Task CurrentWeatherShouldNotBeNull() { HttpMessageHandler handlerMock = MockHttpMessageHandler.CreateMock( new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent( FromEmbedResources.ReadText("ResponseMock.CurrentWeatherResponse.json")) }); var httpClient = new HttpClient(handlerMock); IWeatherService weatherService = new WeatherService(httpClient, ""); WeatherViewModel weatherViewModelMock = MockWeatherViewModel.CreateMock(weatherService).Object; await weatherViewModelMock.GetWeatherAsync(); weatherViewModelMock.CurrentWeather.Should().NotBeNull(); }