public void StatusThresholdsRange() { StatusPropertyThresholds thresholds; StatusAuditAlert alert; thresholds = new StatusPropertyThresholds(10.0f, 20.0f, 30.0f); for (float testLowValue = -5.0f; testLowValue < 35.0f; testLowValue += 5.0f) { for (float testHighValue = testLowValue; testHighValue < 35.0f; testHighValue += 5.0f) { float significantValue = testLowValue; StatusRatingRange expectedRatingRange; if (significantValue <= 10.0f) { expectedRatingRange = StatusRatingRange.Fail; } else if (significantValue <= 20.0f) { expectedRatingRange = StatusRatingRange.Alert; } else if (significantValue <= 30.0f) { expectedRatingRange = StatusRatingRange.Okay; } else { expectedRatingRange = StatusRatingRange.Superlative; } alert = thresholds.Rate("Property", testLowValue, testHighValue); Assert.AreEqual(expectedRatingRange, StatusRating.FindRange(alert.Rating)); } } thresholds = new StatusPropertyThresholds(30.0f, 20.0f, 10.0f); for (float testLowValue = -5.0f; testLowValue < 35.0f; testLowValue += 5.0f) { for (float testHighValue = testLowValue; testHighValue < 35.0f; testHighValue += 5.0f) { float significantValue = testHighValue; StatusRatingRange expectedRatingRange; if (significantValue >= 30.0f) { expectedRatingRange = StatusRatingRange.Fail; } else if (significantValue >= 20.0f) { expectedRatingRange = StatusRatingRange.Alert; } else if (significantValue >= 10.0f) { expectedRatingRange = StatusRatingRange.Okay; } else { expectedRatingRange = StatusRatingRange.Superlative; } alert = thresholds.Rate("Property", testLowValue, testHighValue); Assert.AreEqual(expectedRatingRange, StatusRating.FindRange(alert.Rating)); } } }
public void StatusThresholdsExceptions() { Assert.ThrowsException <ArgumentException>(() => { StatusPropertyThresholds s = new StatusPropertyThresholds(2.0f, 3.0f, 1.0f); }); //StatusThresholds thresholds; //StatusAuditAlert alert; // thresholds = new StatusThresholds(1.0f, 2.0f, 3.0f); // Assert.ThrowsException<ArgumentOutOfRangeException>(() => { alert = thresholds.Rate("Property", -0.0f001); }); }
public void StatusThresholdsClass() { StatusPropertyThresholds thresholds; StatusAuditAlert alert; thresholds = new StatusPropertyThresholds(10.0f, 20.0f, 30.0f); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Catastrophic); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Fail); Assert.IsTrue(alert.Rating < StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); alert = thresholds.Rate("Property", 25.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Alert); Assert.IsTrue(alert.Rating < StatusRating.Okay); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Okay) + " range")); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating >= StatusRating.Okay); Assert.IsTrue(alert.Terse.Contains(">")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); thresholds = new StatusPropertyThresholds(30.0f, 20.0f, 10.0f); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); alert = thresholds.Rate("Property", 25.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Fail); Assert.IsTrue(alert.Rating < StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Alert); Assert.IsTrue(alert.Rating < StatusRating.Okay); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Okay) + " range")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating >= StatusRating.Okay); Assert.IsTrue(alert.Rating < StatusRating.Superlative); Assert.IsTrue(alert.Terse.Contains("<")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Superlative); Assert.IsTrue(alert.Terse.Contains("<")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); thresholds = new StatusPropertyThresholds(null, 20.0f, 30.0f); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Catastrophic); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 25.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Alert); Assert.IsTrue(alert.Rating < StatusRating.Okay); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Okay) + " range")); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating >= StatusRating.Okay); Assert.IsTrue(alert.Rating < StatusRating.Superlative); Assert.IsTrue(alert.Terse.Contains(">")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); thresholds = new StatusPropertyThresholds(null, 20.0f, 10.0f); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); alert = thresholds.Rate("Property", 25.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Alert); Assert.IsTrue(alert.Rating < StatusRating.Okay); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Okay) + " range")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating >= StatusRating.Okay); Assert.IsTrue(alert.Rating < StatusRating.Superlative); Assert.IsTrue(alert.Terse.Contains("<")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Superlative); Assert.IsTrue(alert.Terse.Contains("<")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); thresholds = new StatusPropertyThresholds(null, null, 30.0f, StatusThresholdNature.HighIsGood); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Catastrophic); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 25.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating >= StatusRating.Okay); Assert.IsTrue(alert.Rating < StatusRating.Superlative); Assert.IsTrue(alert.Terse.Contains(">")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); thresholds = new StatusPropertyThresholds(null, null, 10.0f, StatusThresholdNature.LowIsGood); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); alert = thresholds.Rate("Property", 25.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating >= StatusRating.Okay); Assert.IsTrue(alert.Rating < StatusRating.Superlative); Assert.IsTrue(alert.Terse.Contains("<")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Superlative); Assert.IsTrue(alert.Terse.Contains("<")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); thresholds = new StatusPropertyThresholds(10.0f, null, null, StatusThresholdNature.HighIsGood); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Catastrophic); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating < StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating >= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); alert = thresholds.Rate("Property", 25.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating >= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating >= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); thresholds = new StatusPropertyThresholds(30.0f, null, null, StatusThresholdNature.LowIsGood); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); alert = thresholds.Rate("Property", 25.0f); Assert.IsTrue(alert.Rating > StatusRating.Fail); Assert.IsTrue(alert.Rating < StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Fail); Assert.IsTrue(alert.Rating < StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Fail); Assert.IsTrue(alert.Rating < StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); thresholds = new StatusPropertyThresholds(10.0f, 20.0f, null, StatusThresholdNature.HighIsGood); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Catastrophic); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating < StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Fail); Assert.IsTrue(alert.Rating < StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); alert = thresholds.Rate("Property", 25.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating >= StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Okay) + " range")); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating >= StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Okay) + " range")); thresholds = new StatusPropertyThresholds(30.0f, 20.0f, null, StatusThresholdNature.LowIsGood); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); alert = thresholds.Rate("Property", 25.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Fail); Assert.IsTrue(alert.Rating < StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Alert); Assert.IsTrue(alert.Rating < StatusRating.Okay); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Okay) + " range")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Okay) + " range")); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Okay); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Okay) + " range")); thresholds = new StatusPropertyThresholds(null, null, null, StatusThresholdNature.HighIsGood); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Catastrophic); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 25.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); thresholds = new StatusPropertyThresholds(null, null, null, StatusThresholdNature.LowIsGood); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); alert = thresholds.Rate("Property", 25.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); thresholds = new StatusPropertyThresholds(10.0f, null, 30.0f, StatusThresholdNature.HighIsGood); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Catastrophic); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating < StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("at or below")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Fail); Assert.IsTrue(alert.Rating < StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); alert = thresholds.Rate("Property", 25.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Fail); Assert.IsTrue(alert.Rating < StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains("<=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating >= StatusRating.Okay); Assert.IsTrue(alert.Terse.Contains(">")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); thresholds = new StatusPropertyThresholds(30.0f, null, 10.0f, StatusThresholdNature.LowIsGood); alert = thresholds.Rate("Property", 35.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating <= StatusRating.Fail); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("at or above")); alert = thresholds.Rate("Property", 25.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Fail); Assert.IsTrue(alert.Rating < StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); alert = thresholds.Rate("Property", 15.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Fail); Assert.IsTrue(alert.Rating < StatusRating.Alert); Assert.IsTrue(alert.Terse.Contains(">=")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Alert) + " range")); alert = thresholds.Rate("Property", 5.0f); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating > StatusRating.Okay); Assert.IsTrue(alert.Terse.Contains("<")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); alert = thresholds.Rate("Property", 0); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Superlative); Assert.IsTrue(alert.Terse.Contains("<")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); thresholds = new StatusPropertyThresholds(10.0f, 20.0f, 30.0f); alert = thresholds.Rate("Property", Single.MaxValue); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Superlative); Assert.IsTrue(alert.Terse.Contains(">")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); thresholds = new StatusPropertyThresholds(10.0f, 20.0f, 30.0f); alert = thresholds.Rate("Property", Single.PositiveInfinity); Assert.AreEqual("Property.Threshold", alert.AuditAlertCode); Assert.IsTrue(alert.Rating == StatusRating.Superlative); Assert.IsTrue(alert.Terse.Contains(">")); Assert.IsTrue(alert.Details.Contains("in the " + nameof(StatusRating.Superlative) + " range")); }