예제 #1
0
        public async Task Forecast_Should_Not_Be_Empty()
        {
            //Arrange
            _weatherApiManager
            .Setup(e => e.GetForecast(It.IsAny <string>(), It.IsAny <string>()))
            .ReturnsAsync(new List <WeatherInfo>
            {
                new WeatherInfo
                {
                    Date        = DateTime.Now,
                    Description = "Mock test",
                    FeelsLike   = 1,
                    Humidity    = 1,
                    Location    = "Mock Location",
                    SkyStatus   = "Rain",
                    Temp        = 1,
                    WindInfo    = new WeatherInfo.Wind
                    {
                        Degree = 1,
                        Speed  = 1
                    }
                },
                new WeatherInfo
                {
                    Date        = DateTime.Now,
                    Description = "Mock test",
                    FeelsLike   = 1,
                    Humidity    = 1,
                    Location    = "Mock Location",
                    SkyStatus   = "Rain",
                    Temp        = 1,
                    WindInfo    = new WeatherInfo.Wind
                    {
                        Degree = 1,
                        Speed  = 1
                    }
                }
            })
            .Verifiable();

            //Act
            await _HomePageViewModel.FetchForecast();

            //Assert
            _weatherApiManager.Verify(e => e.GetForecast(It.IsAny <string>(), It.IsAny <string>()));
            Assert.IsTrue(_HomePageViewModel.Forecasts.Count > 0);
        }