Пример #1
0
        public void TestStopOne()
        {
            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.Stop(SupervisionStrategyConstants.Scope.One);

            Assert.Equal(1, access.ReadFromExpecting("stoppedCount", 1));
        }
        public void TestStopOne()
        {
            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);

            failureControlTestResults.UntilStopped = Until(1);

            supervised.Stop(SupervisionStrategyConstants.Scope.One);
            failureControlTestResults.UntilStopped.Completes();

            Assert.True(FailureControlActor.Instance.Value.IsStopped);
        }
Пример #3
0
        public void TestStopAll()
        {
            var pingTestResults = new PingActor.PingTestResults();

            World.ActorFor <IPing>(Definition.Has <PingActor>(Definition.Parameters(pingTestResults), "ping"));

            var pongTestResults = new PongActor.PongTestResults();

            World.ActorFor <IPong>(Definition.Has <PongActor>(Definition.Parameters(pongTestResults), "pong"));

            var pingAccess = pingTestResults.AfterCompleting(1);
            var pongAccess = pongTestResults.AfterCompleting(1);

            var supervised = new StageSupervisedActor <IPing>(PingActor.Instance.Value, new ApplicationException("Failed"));

            supervised.Stop(SupervisionStrategyConstants.Scope.All);

            Assert.Equal(1, pingAccess.ReadFromExpecting("stopCount", 1));
            Assert.Equal(1, pongAccess.ReadFromExpecting("stopCount", 1));
        }
        public void TestStopAll()
        {
            var pingTestResults = new PingActor.PingTestResults();

            World.ActorFor <IPing>(Definition.Has <PingActor>(Definition.Parameters(pingTestResults), "ping"));

            var pongTestResults = new PongActor.PongTestResults();

            World.ActorFor <IPong>(Definition.Has <PongActor>(Definition.Parameters(pongTestResults), "pong"));

            pingTestResults.UntilStopped = Until(1);
            pongTestResults.UntilStopped = Until(1);

            var supervised = new StageSupervisedActor <IPing>(PingActor.Instance.Value, new ApplicationException("Failed"));

            supervised.Stop(SupervisionStrategyConstants.Scope.All);

            pingTestResults.UntilStopped.Completes();
            pongTestResults.UntilStopped.Completes();

            Assert.True(PingActor.Instance.Value.IsStopped);
            Assert.True(PongActor.Instance.Value.IsStopped);
        }