예제 #1
0
        public void TestSuspendResume()
        {
            var failureControlTestResults = new FailureControlActor.FailureControlTestResults();
            var failure = World.ActorFor <IFailureControl>(
                Definition.Has <FailureControlActor>(
                    Definition.Parameters(failureControlTestResults), "failure"));

            var exception  = new ApplicationException("Failed");
            var supervised = new StageSupervisedActor <IFailureControl>(FailureControlActor.Instance.Value, exception);

            var access = failureControlTestResults.AfterCompleting(1);

            supervised.Suspend();
            Assert.True(IsSuspended(FailureControlActor.Instance.Value));

            failure.AfterFailure(); // into suspended stowage
            supervised.Resume();    // sent

            Assert.Equal(1, access.ReadFromExpecting("afterFailureCount", 1));
        }
        public void TestSuspendResume()
        {
            var failureControlTestResults = new FailureControlActor.FailureControlTestResults();
            var failure = World.ActorFor <IFailureControl>(
                Definition.Has <FailureControlActor>(
                    Definition.Parameters(failureControlTestResults), "failure"));

            failureControlTestResults.UntilAfterFail = Until(1);
            var exception  = new ApplicationException("Failed");
            var supervised = new StageSupervisedActor <IFailureControl>(FailureControlActor.Instance.Value, exception);

            supervised.Suspend();
            Assert.True(IsSuspended(FailureControlActor.Instance.Value));

            failure.AfterFailure();                               // into suspended stowage
            supervised.Resume();                                  // sent
            failureControlTestResults.UntilAfterFail.Completes(); // delivered

            Assert.Equal(1, failureControlTestResults.AfterFailureCount.Get());
        }