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));
        }
Exemplo n.º 3
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();
        }
Exemplo 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();
 }