예제 #1
0
        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);
        }