Beispiel #1
0
        public void AddHistoryObject_When_history_Then_added_history()
        {
            // Arrange
            var reducedForecastPerDay = new ReducedForecastPerDay
            {
                Time          = 444,
                DayTemp       = 1,
                NightTemp     = 2,
                EveningTemp   = 3,
                MorningTemp   = 4,
                Rain          = "rain",
                Pressure      = 1000,
                Humidity      = 57,
                WindSpeed     = 12,
                WindDirection = 234,
                Clouds        = 65
            };

            var history1 = new HistoryWeatherDataObject
            {
                Id                    = 1,
                City                  = "city1",
                CountDays             = 1,
                RequestTime           = DateTime.Now,
                ReducedForecastPerDay = reducedForecastPerDay
            };

            // Act
            _weatherService.AddHistoryObject(history1);

            // Assert
            using (var db = new WeatherContext())
            {
                Assert.IsNotNull(db.History.FirstOrDefault(h => h.City == history1.City));
            }
        }