public void ChildExpiry_PospondsParentExpiry(ReportingStrategy reportingStrategy) { _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy); _healthStatus.SetGood("", TimeSpan.FromSeconds(1), "parent", "child1"); // now parent is in one second delay _healthStatus.SetBad("", TimeSpan.FromSeconds(2), "parent", "child2"); // child2 will expire only after two seconds _dateTimeFake.UtcNow += TimeSpan.FromSeconds(1); _getHealthResult().IsHealthy.ShouldBe(false); }
public void ChildState_TurnToGood_IsHealthy(ReportingStrategy reportingStrategy) { _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy); _healthStatus.SetBad("", TimeSpan.FromSeconds(1), "child"); _getHealthResult().IsHealthy.ShouldBe(false); _healthStatus.SetGood("", TimeSpan.FromSeconds(1), "child"); _getHealthResult().IsHealthy.ShouldBe(true); }
public void UnhealthyOnAtLeastOneChild_UnsetBadChild_IsHealthy(ReportingStrategy reportingStrategy) { _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy); _healthStatus.SetBad("", TimeSpan.FromSeconds(1), "parent", "child"); _getHealthResult().IsHealthy.ShouldBe(false); _healthStatus.Unset("parent", "child"); _getHealthResult().IsHealthy.ShouldBe(true); }
public void MessageShouldContainChildDetails(ReportingStrategy reportingStrategy) { _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy); var childDetails = "child details"; _healthStatus.SetGood(childDetails, TimeSpan.FromSeconds(1), "child1"); var result = _getHealthResult(); result.IsHealthy.ShouldBe(true); result.Message.ShouldContain(childDetails); }
public void ChildMessage_Expires(ReportingStrategy reportingStrategy) { _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy); _healthStatus.SetGood("details", TimeSpan.FromSeconds(1), "level1"); var result = _getHealthResult(); result.Message.ShouldContain("details"); _dateTimeFake.UtcNow += TimeSpan.FromSeconds(1); result = _getHealthResult(); result.Message.ShouldNotContain("details"); }
public void BadState_Expires(ReportingStrategy reportingStrategy) { _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy); _healthStatus.SetBad("", TimeSpan.FromSeconds(1), "level1"); var result = _getHealthResult(); result.IsHealthy.ShouldBe(false); _dateTimeFake.UtcNow += TimeSpan.FromSeconds(1); result = _getHealthResult(); result.IsHealthy.ShouldBe(true); }
public void Rx_CalculateAccessToTreatmentIssuesSectionTests() { var unsteadinessOrLossOfBalance = TestContext.GetLookup <YesNoNotSure>("UnsteadinessOrLossOfBalance"); var mobilityProblemsMayAffectTreatmentAttendance = TestContext.GetLookup <YesNoNotSure>("MobilityProblemsMayAffectTreatmentAttendance"); var hasValidDriversLicense = TestContext.GetBoolean("HasValidDriversLicense"); var numberOfDependents = TestContext.GetUInt32("NumberOfDependents"); var isOnProbationOrParole = TestContext.GetBoolean("IsOnProbationOrParole"); var isCurrentlyAwaitingChargesTrialSentence = TestContext.GetBoolean("IsCurrentlyAwaitingChargesTrialSentence"); var isAbleToLocateAndGetToCommunityResourcesSafely = TestContext.GetBoolean("IsAbleToLocateAndGetToCommunityResourcesSafely"); var isPatientAvailableForFollowupFor7Days = TestContext.GetLookup <YesNoNotSure>("IsPatientAvailableForFollowupFor7Days"); var isOutpatientMonitoringAvailable8To24Hours = TestContext.GetLookup <YesNoNotSure>("IsOutpatientMonitoringAvailable8To24Hours"); var evidenceOfChronicOrganicMentalDisability = TestContext.GetLookup <YesNoNotSure>("EvidenceOfChronicOrganicMentalDisability"); var currentBehaviorInconsistentWithSelfCare = TestContext.GetLookup <YesNoNotSure>("CurrentBehaviorInconsistentWithSelfCare"); var psychiatricEvaluationAndServicesAccessibleToPatient = TestContext.GetLookup <YesNoNotSure>("PsychiatricEvaluationAndServicesAccessibleToPatient"); var intensiveCaseManagementAccessibleToPatient = TestContext.GetLookup <YesNoNotSure>("IntensiveCaseManagementAccessibleToPatient"); var isAbleToSelfAdministerMedication = TestContext.GetLookup <YesNoNotApplicable>("IsAbleToSelfAdministerMedication"); var count = TestContext.GetInt32("Count"); var reportingStrategy = new ReportingStrategy(); reportingStrategy.ResourceWrapper = new ResourceWrapper(new PronounProcessor(new PersonName("Ms.", "Jane", "", "Jones", ""), Gender.Female)); var accessToTreatmentIssuesSection = reportingStrategy.CalculateAccessToTreatmentIssuesSection( unsteadinessOrLossOfBalance, mobilityProblemsMayAffectTreatmentAttendance, hasValidDriversLicense, numberOfDependents, isOnProbationOrParole, isCurrentlyAwaitingChargesTrialSentence, isAbleToLocateAndGetToCommunityResourcesSafely, isPatientAvailableForFollowupFor7Days, isOutpatientMonitoringAvailable8To24Hours, evidenceOfChronicOrganicMentalDisability, currentBehaviorInconsistentWithSelfCare, psychiatricEvaluationAndServicesAccessibleToPatient, intensiveCaseManagementAccessibleToPatient, isAbleToSelfAdministerMedication); Assert.AreEqual(count, accessToTreatmentIssuesSection.AccessItems.Count, "AccessItems.Count didn't match."); }
public IMutationTest MergeReportTo(string fileName) { _reportingStrategy = new MergeReportingStrategy(); _reportFileName = fileName; return(this); }
public void Default_IsHealthy(ReportingStrategy reportingStrategy) { _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy); _getHealthResult().IsHealthy.ShouldBe(true); }
public PassiveAggregatingHealthCheck(IDateTime dateTime, string componentName, IHealthMonitor healthMonitor, ReportingStrategy reportingStrategy) { _reportingStrategy = reportingStrategy; DateTime = dateTime; healthMonitor.SetHealthFunction(componentName, GetHealthStatusAndCleanup); }