Пример #1
0
        public async Task DeleteWeather_WhenCityNotAssigned_ThrowsException()
        {
            var httpClientStub = new Mock <IWeatherApiClient>();
            var mapperStub     = new Mock <IMapper>();

            httpClientStub.Setup(e => e.GetWeatherDto(It.IsAny <string>()))
            .Returns(Task.FromResult(new WeatherDto()));

            var weatherService = new WeatherService
                                     (mapperStub.Object, Context, httpClientStub.Object);
            var actual = weatherService.DeleteWeather
                             ("Warsaw", Guid.Parse("46b41624-0050-4221-a722-f06914f3f152"));

            await Assert.ThrowsAsync <CityNotAssignedException>(() => actual);
        }
Пример #2
0
        public async Task DeleteWeather_ByDefault_ReturnsCorrectType()
        {
            var httpClientStub = new Mock <IWeatherApiClient>();
            var mapperStub     = new Mock <IMapper>();

            httpClientStub.Setup(e => e.GetWeatherDto(It.IsAny <string>()))
            .Returns(Task.FromResult(new WeatherDto()));

            var weatherService = new WeatherService
                                     (mapperStub.Object, Context, httpClientStub.Object);

            var actual = await weatherService.DeleteWeather
                             ("Warsaw", Guid.Parse("31035f07-4524-4adc-b0cf-1a53d4eb3fb1"));

            Assert.IsAssignableFrom <ICollection <WeatherDto> >(actual);
        }