public async Task GetAndStoreBarometer_IntegrationTest() { var settings = new Settings(); // Arrange var filename = $"c:\\temp\\{nameof(GetAndStoreBarometer_IntegrationTest)}.txt"; File.Delete(filename); var barometer = new BarometerSerial(settings.serialPort); var storage = new NeuLogFlatFile(filename); var logic = new NeuLogLogic(barometer, storage); // Act await logic.GetAndStoreBarometer(); // Assert var result = File.ReadAllLines(filename); Assert.AreEqual(1, result.Length); var parts = result[0].Split(new char[] { '\t' }); Assert.AreEqual(2, parts.Length); var pressure = decimal.Parse(parts[1]); Assert.IsTrue(pressure > 0); DateTime dateWritten; DateTime.TryParse(parts[0], out dateWritten); Assert.IsTrue(DateTime.UtcNow > dateWritten); Assert.IsTrue(DateTime.UtcNow.AddHours(-1) < dateWritten); }