Example #1
0
        public void TestEscalate()
        {
            var escalateSupervisorTestResults = new EscalateSupervisorActor.EscalateSupervisorTestResults();
            var supervisor = TestWorld.ActorFor <ISupervisor>(
                Definition.Has <EscalateSupervisorActor>(
                    Definition.Parameters(escalateSupervisorTestResults), "escalate"));
            var failureControlTestResults = new FailureControlActor.FailureControlTestResults();
            var failure = TestWorld.ActorFor <IFailureControl>(
                Definition.Has <FailureControlActor>(
                    Definition.Parameters(failureControlTestResults), supervisor.ActorInside, "failure"));

            failureControlTestResults.UntilFailNow   = Until(1);
            failureControlTestResults.UntilAfterFail = Until(1);

            Assert.Equal(0, escalateSupervisorTestResults.InformedCount.Get());
            Assert.Equal(0, failureControlTestResults.StoppedCount.Get());

            failure.Actor.FailNow();

            failureControlTestResults.UntilFailNow.Completes();
            failureControlTestResults.UntilStopped.Completes();

            Assert.Equal(1, escalateSupervisorTestResults.InformedCount.Get());
            Assert.Equal(1, failureControlTestResults.StoppedCount.Get());
        }
Example #2
0
        public void TestEscalate()
        {
            var escalateSupervisorTestResults = new EscalateSupervisorActor.EscalateSupervisorTestResults();
            var supervisor = TestWorld.ActorFor <ISupervisor>(
                Definition.Has <EscalateSupervisorActor>(
                    Definition.Parameters(escalateSupervisorTestResults), "escalate"));
            var failureControlTestResults = new FailureControlActor.FailureControlTestResults();
            var failure = TestWorld.ActorFor <IFailureControl>(
                Definition.Has <FailureControlActor>(
                    Definition.Parameters(failureControlTestResults), supervisor.ActorInside, "failure"));

            var escalateAccess = escalateSupervisorTestResults.AfterCompleting(1);
            var failureAccess  = failureControlTestResults.AfterCompleting(1);

            failure.Actor.FailNow();

            Assert.Equal(1, escalateAccess.ReadFrom <int>("informedCount"));
            Assert.Equal(1, failureAccess.ReadFrom <int>("stoppedCount"));
        }