Exemple #1
0
        public async Task GetWeatherObservationFromDateGet1()
        {
            using (var context = new ApplicationContext(_options))
            {
                context.Database.EnsureCreated();

                WeatherObservationsController uut = new WeatherObservationsController(context, _hubContext);

                var result = await uut.GetWeatherObservation(DateTime.Today.AddDays(-10));

                Assert.Equal("Denmark", result.Value.FirstOrDefault().LocationName);
            }
        }
Exemple #2
0
        public async void PostWeatherObservation_CreatesCorrectObservation()
        {
            dbcontext.Database.EnsureCreated();
            var hugo = new WeatherObservation {
                Date = DateTime.Now, Location = new Location {
                    Name = "København"
                }
            };
            await uut.PostWeatherObservation(hugo);

            var a = await uut.GetWeatherObservation();

            List <WeatherObservation> li = a.Value.ToList();

            Assert.Equal("København", li.ElementAt(0).Location.Name);
            dbcontext.Database.EnsureDeleted();
        }