public void Initialize()
        {
            // arrange
            this.serviceMock = new WeatherServiceMock();
            this.target = new OldMainViewModel(serviceMock);

            this.dummyCurrentWeather = CreateDummyCurrentWeather();
            this.dummyWeatherInfo = CreateWeatherInfo();

            this.serviceMock
                .AddHandlers()
                    .GetCurrentWeatherAsync(() => Task.FromResult(dummyCurrentWeather))
                    .GetWeatherAsync(() => Task.FromResult(dummyWeatherInfo));
        }
        public void Initialize()
        {
            // arrange
            this.serviceMock = new WeatherServiceMock();
            this.target      = new OldMainViewModel(serviceMock);

            this.dummyCurrentWeather = CreateDummyCurrentWeather();
            this.dummyWeatherInfo    = CreateWeatherInfo();

            this.serviceMock
            .AddHandlers()
            .GetCurrentWeatherAsync(() => Task.FromResult(dummyCurrentWeather))
            .GetWeatherAsync(() => Task.FromResult(dummyWeatherInfo));
        }
        public async Task MockTest()
        {
            // arange
            var service = new WeatherServiceMock();
            service
                .AddVerifications()
                    .GetCityWeatherAsync(CityName)
                    .GetCurrentCityWeatherAsync(CityName);


            // act
            await service.GetCityWeatherAsync(CityName);
            await service.GetCurrentCityWeatherAsync(CityName);

            // asserts
            service.VerifyAll();
        }
Esempio n. 4
0
        public async Task MockTest()
        {
            // arange
            var service = new WeatherServiceMock();

            service
            .AddVerifications()
            .GetCityWeatherAsync(CityName)
            .GetCurrentCityWeatherAsync(CityName);


            // act
            await service.GetCityWeatherAsync(CityName);

            await service.GetCurrentCityWeatherAsync(CityName);

            // asserts
            service.VerifyAll();
        }
 public WeatherServiceTests()
 {
     _weatherService = WeatherServiceMock.GetWeatherServiceMock();
 }