コード例 #1
0
        public void VertexTypeToProcess()
        {
            var distributor = new Mock <IDistributeScheduleExecutions>();
            var processor   = new SubScheduleVertexProcessor(distributor.Object);

            Assert.AreEqual(typeof(SubScheduleVertex), processor.VertexTypeToProcess);
        }
コード例 #2
0
 public void ProcessWithIncorrectVertexType()
 {
     var distributor = new Mock<IDistributeScheduleExecutions>();
     var processor = new SubScheduleVertexProcessor(distributor.Object);
     using (var info = new ScheduleExecutionInfo())
     {
         var state = processor.Process(new StartVertex(1), info);
         Assert.AreEqual(ScheduleExecutionState.IncorrectProcessorForVertex, state);
     }
 }
コード例 #3
0
        public void ProcessWithIncorrectVertexType()
        {
            var distributor = new Mock <IDistributeScheduleExecutions>();
            var processor   = new SubScheduleVertexProcessor(distributor.Object);

            using (var info = new ScheduleExecutionInfo())
            {
                var state = processor.Process(new StartVertex(1), info);
                Assert.AreEqual(ScheduleExecutionState.IncorrectProcessorForVertex, state);
            }
        }
コード例 #4
0
        public void ProcessWithCancellation()
        {
            var distributor = new Mock<IDistributeScheduleExecutions>();
            using (var info = new ScheduleExecutionInfo())
            {
                info.CancelScheduleExecution();

                var processor = new SubScheduleVertexProcessor(distributor.Object);
                var state = processor.Process(new SubScheduleVertex(1, new ScheduleId()), info);
                Assert.AreEqual(ScheduleExecutionState.Canceled, state);
            }
        }
コード例 #5
0
        public void ProcessWithCancellation()
        {
            var distributor = new Mock <IDistributeScheduleExecutions>();

            using (var info = new ScheduleExecutionInfo())
            {
                info.CancelScheduleExecution();

                var processor = new SubScheduleVertexProcessor(distributor.Object);
                var state     = processor.Process(new SubScheduleVertex(1, new ScheduleId()), info);
                Assert.AreEqual(ScheduleExecutionState.Canceled, state);
            }
        }
コード例 #6
0
        public void Process()
        {
            var subExecutor = new Mock <IExecuteSchedules>();
            {
                subExecutor.Setup(s => s.IsLocal)
                .Returns(false);
            }

            var distributor = new Mock <IDistributeScheduleExecutions>();
            {
                distributor.Setup(
                    d => d.Execute(
                        It.IsAny <ScheduleId>(),
                        It.IsAny <IEnumerable <IScheduleVariable> >(),
                        It.IsAny <ScheduleExecutionInfo>(),
                        It.IsAny <bool>()))
                .Returns(subExecutor.Object)
                .Verifiable();
            }

            var id = new ScheduleId();

            var processor = new SubScheduleVertexProcessor(distributor.Object);

            using (var info = new ScheduleExecutionInfo())
            {
                var state = processor.Process(new SubScheduleVertex(1, id), info);
                Assert.AreEqual(ScheduleExecutionState.Executing, state);
                distributor.Verify(
                    d => d.Execute(
                        It.Is <ScheduleId>(incoming => incoming.Equals(id)),
                        It.IsAny <IEnumerable <IScheduleVariable> >(),
                        It.IsAny <ScheduleExecutionInfo>(),
                        It.IsAny <bool>()),
                    Times.Once());
            }
        }
コード例 #7
0
        public void Process()
        {
            var subExecutor = new Mock<IExecuteSchedules>();
            {
                subExecutor.Setup(s => s.IsLocal)
                    .Returns(false);
            }

            var distributor = new Mock<IDistributeScheduleExecutions>();
            {
                distributor.Setup(
                    d => d.Execute(
                        It.IsAny<ScheduleId>(),
                        It.IsAny<IEnumerable<IScheduleVariable>>(),
                        It.IsAny<ScheduleExecutionInfo>(),
                        It.IsAny<bool>()))
                    .Returns(subExecutor.Object)
                    .Verifiable();
            }

            var id = new ScheduleId();

            var processor = new SubScheduleVertexProcessor(distributor.Object);
            using (var info = new ScheduleExecutionInfo())
            {
                var state = processor.Process(new SubScheduleVertex(1, id), info);
                Assert.AreEqual(ScheduleExecutionState.Executing, state);
                distributor.Verify(
                    d => d.Execute(
                        It.Is<ScheduleId>(incoming => incoming.Equals(id)),
                        It.IsAny<IEnumerable<IScheduleVariable>>(),
                        It.IsAny<ScheduleExecutionInfo>(),
                        It.IsAny<bool>()),
                    Times.Once());
            }
        }
コード例 #8
0
 public void VertexTypeToProcess()
 {
     var distributor = new Mock<IDistributeScheduleExecutions>();
     var processor = new SubScheduleVertexProcessor(distributor.Object);
     Assert.AreEqual(typeof(SubScheduleVertex), processor.VertexTypeToProcess);
 }