public void VertexTypeToProcess() { var distributor = new Mock <IDistributeScheduleExecutions>(); var processor = new SubScheduleVertexProcessor(distributor.Object); Assert.AreEqual(typeof(SubScheduleVertex), processor.VertexTypeToProcess); }
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); } }
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); } }
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); } }
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); } }
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()); } }
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()); } }
public void VertexTypeToProcess() { var distributor = new Mock<IDistributeScheduleExecutions>(); var processor = new SubScheduleVertexProcessor(distributor.Object); Assert.AreEqual(typeof(SubScheduleVertex), processor.VertexTypeToProcess); }