public async Task PostWeatherLog_SeededLogs() { //Arrange _context = new ApplicationDbContext( new DbContextOptionsBuilder <ApplicationDbContext>().UseSqlite(CreateInMemoryDatabase()).Options); _mockHub = Substitute.For <IHubContext <WeatherHub> >(); _weatherController = new WeatherLogsController(_context, _mockHub); Seed(); WeatherLogDto tempweatherlog = new WeatherLogDto() { LogTime = new DateTime(2021, 10, 9, 8, 00, 00), LogPlaceId = 1, Temperature = 24, Humidity = 90, AirPressure = 85 }; //Act var res = await _weatherController.PostWeatherLog(tempweatherlog); var got = await _weatherController.GetWeatherLog(4); //Assert Assert.Equal(90, got.Value.Humidity); Dispose(); }
public async Task PostWeatherLog_SeededLogs() { WeatherLogDto tempweatherlog = new WeatherLogDto() { LogTime = new DateTime(2021, 10, 9, 8, 00, 00), LogPlaceId = 1, Temperature = 24, Humidity = 90, AirPressure = 85 }; var res = await _weatherController.PostWeatherLog(tempweatherlog); var got = await _weatherController.GetWeatherLog(4); Assert.Equal(90, got.Value.Humidity); }