public void CheckStatus_HasNan_CreatesSingleAlert() { // Arrange var s = new FileStream(fileWithBadNAN, FileMode.Open); string contents = convertStreamToString(s); var e = new TOA5Extractor( "CookEastEcTower_Flux_Raw_2017_11_03_1300_badNAN.dat", contents, -8); var a = new MockTweeter(); StatusChecker sut = new StatusChecker(e, a); // Act var alerts = sut.CheckStatus(); // Assert Assert.Single(alerts); }
public void CheckStatus_HasNanAtOkLocations_NoAlert() { // Arrange var s = new FileStream(fileWithNANOkLocations, FileMode.Open); string contents = convertStreamToString(s); var e = new TOA5Extractor( "CookEastEcTower_Flux_Raw_2017_11_03_1300_okNAN.dat", contents, -8); var a = new MockTweeter(); StatusChecker sut = new StatusChecker(e, a); // Act var alerts = sut.CheckStatus(); // Assert Assert.Empty(alerts); }
public void CheckStatus_HasBadValueAtSecondRowAndNAN_CreatesExpectedAlertString() { // Arrange var s = new FileStream(fileWithBadDataAtSecondRowAndNAN, FileMode.Open); string contents = convertStreamToString(s); var e = new TOA5Extractor( "CookEastEcTower_Flux_Raw_2017_11_03_1300_2linesBadCO2BadNAN.dat", contents, -8); var a = new MockTweeter(); StatusChecker sut = new StatusChecker(e, a); string expected = "[E] CookEastEcTower_Flux_Raw_2017_11_03_1300_2linesBadCO2BadNAN.dat: Null values > 3.\r\n[W] CookEastEcTower_Flux_Raw_2017_11_03_1300_2linesBadCO2BadNAN.dat: CO2_sig_strgth_Min < 0.8 (0.7)."; // Act var alerts = sut.CheckStatus(); // Assert Assert.Equal(2, alerts.Count); Assert.Equal( expected, string.Join("\r\n", alerts)); }