public void Return_text_with_sne_when_today_temperature_is_below_or_equal_0_degrees_and_yesterday_was_sne_with_temperature_below_or_equal_0_degrees(string todayConditions, double todayTemperature, string yesterdayConditions, double yesterdayTemperature)
        {
            var    mapper       = new WeatherForecastMapper();
            string expectedText = $"Der er sne i {Location}! Og det er frost-grader. Lad os kælke.";
            string actualText   = mapper.MapWeatherInfo(Location, new WeatherInfo(todayConditions, todayTemperature), new WeatherInfo(yesterdayConditions, yesterdayTemperature));

            Assert.Equal(expectedText.IgnoreSpecialCharacters(), actualText.IgnoreSpecialCharacters());
        }
        public void Return_text_with_regn_when_today_temperature_is_below_or_equal_20_degrees_and_yesterday_was_skyet_with_temperature_above_20_degrees(string todayConditions, double todayTemperature, string yesterdayConditions, double yesterdayTemperature)
        {
            var    mapper       = new WeatherForecastMapper();
            string expectedText = $"Det er blevet regnvejr i {Location} - og koldt. I går var det skyet over varmt.";
            string actualText   = mapper.MapWeatherInfo(Location, new WeatherInfo(todayConditions, todayTemperature), new WeatherInfo(yesterdayConditions, yesterdayTemperature));

            Assert.Equal(expectedText.IgnoreSpecialCharacters(), actualText.IgnoreSpecialCharacters());
        }
        public void Return_text_with_regn_when_today_temperature_is_above_20_degrees_and_yesterday_was_klartvejr_with_temperature_above_20_degrees(string todayConditions, double todayTemperature, string yesterdayConditions, double yesterdayTemperature)
        {
            var    mapper       = new WeatherForecastMapper();
            string expectedText =
                $"Det er ikke længere klart vejr. Vejret i {Location} er regnfuldt, men stadig over 20 grader. Tag regntøj på og hop i vandpytter.";
            string actualText = mapper.MapWeatherInfo(Location, new WeatherInfo(todayConditions, todayTemperature), new WeatherInfo(yesterdayConditions, yesterdayTemperature));

            Assert.Equal(expectedText.IgnoreSpecialCharacters(), actualText.IgnoreSpecialCharacters());
        }
        public void Return_text_with_klartvejr_when_today_temperature_is_below_or_equal_20_degrees_and_yesterday_was_skyet_with_temperature_below_or_equal_20_degrees(string todayConditions, double todayTemperature, string yesterdayConditions, double yesterdayTemperature)
        {
            var mapper = new WeatherForecastMapper();

            string expectedText = $"Det er klaret op, men stadig koldt i {Location}.";
            string actualText   = mapper.MapWeatherInfo(Location, new WeatherInfo(todayConditions, todayTemperature), new WeatherInfo(yesterdayConditions, yesterdayTemperature));

            Assert.Equal(expectedText.IgnoreSpecialCharacters(), actualText.IgnoreSpecialCharacters());
        }
        public void Return_default_text_when_no_conditions_is_found(string todayConditions, double?todayTemperature, string yesterdayConditions, double?yesterdayTemperature)
        {
            var    mapper       = new WeatherForecastMapper();
            string expectedText =
                $"Vejret i {Location} er {todayConditions} og der er {todayTemperature} grader. I går var det {yesterdayConditions} og {yesterdayTemperature} grader.";
            string actualText = mapper.MapWeatherInfo(Location, new WeatherInfo(todayConditions, todayTemperature), new WeatherInfo(yesterdayConditions, yesterdayTemperature));

            Assert.Equal(expectedText.IgnoreSpecialCharacters(), actualText.IgnoreSpecialCharacters());
        }
        public void Return_text_with_klartvejr_when_today_temperature_is_below_or_equal_0_degrees_and_yesterday_was_klartvejr_with_temperature_above_0_degrees(string todayConditions, double todayTemperature, string yesterdayConditions, double yesterdayTemperature)
        {
            var mapper = new WeatherForecastMapper();

            string expectedText =
                $"Temperaturen er faldet til frost-grader i {Location}, men det er stadig klart vejr.";
            string actualText = mapper.MapWeatherInfo(Location, new WeatherInfo(todayConditions, todayTemperature), new WeatherInfo(yesterdayConditions, yesterdayTemperature));

            Assert.Equal(expectedText.IgnoreSpecialCharacters(), actualText.IgnoreSpecialCharacters());
        }
        public void Return_text_with_klartvejr_when_today_temperature_is_above_20_degrees_and_yesterday_was_regn_with_temperature_below_or_equal_20_degrees(string todayConditions, double todayTemperature, string yesterdayConditions, double yesterdayTemperature)
        {
            var mapper = new WeatherForecastMapper();

            string expectedText =
                $"Temperaturen i {Location} er endelig over 20 grader og klart vejr. I forhold til i går, hvor der regnede og var koldt.";
            string actualText = mapper.MapWeatherInfo(Location, new WeatherInfo(todayConditions, todayTemperature), new WeatherInfo(yesterdayConditions, yesterdayTemperature));

            Assert.Equal(expectedText.IgnoreSpecialCharacters(), actualText.IgnoreSpecialCharacters());
        }
        public void Return_andet_text_when_conditions_is_andet(string todayConditions, double todayTemperature, string yesterdayConditions, double yesterdayTemperature)
        {
            var mapper = new WeatherForecastMapper();

            string expectedText =
                $"Det har ikke været muligt for systemet at se vejr-betingelserne i {Location}, men temperaturen er: {todayTemperature} grader. I går var den: {yesterdayTemperature} grader.";
            string actualText = mapper.MapWeatherInfo(Location, new WeatherInfo(todayConditions, todayTemperature), new WeatherInfo(yesterdayConditions, yesterdayTemperature));

            Assert.Equal(expectedText.IgnoreSpecialCharacters(), actualText.IgnoreSpecialCharacters());
        }
        public void ThrowArgumentException_when_any_information_is_null(string todayConditions, double?todayTemperature, string yesterdayConditions, double?yesterdayTemperature)
        {
            var mapper = new WeatherForecastMapper();

            Assert.Throws <ArgumentException>(() => mapper.MapWeatherInfo(null, new WeatherInfo(todayConditions, todayTemperature), new WeatherInfo(yesterdayConditions, yesterdayTemperature)));
        }
Esempio n. 10
0
 public void Post(WeatherForecastExt weatherForecastExt)
 {
     _weatherForecastPost.Save(WeatherForecastMapper.MapToBusiness(weatherForecastExt));
 }
Esempio n. 11
0
 public WeatherForecast(WeatherService service, HttpClient httpClient, WeatherForecastMapper mapper)
 {
     _service    = service;
     _httpClient = httpClient;
     _mapper     = new WeatherForecastMapper();
 }