public ISequenceSpecification TheRest() { if (FirstInSequence) { SequenceSpecification.First <IStartupTask>(); } else { SequenceSpecification.Then <IStartupTask>(); } return(SequenceSpecification); }
public void ShouldReturnAFirstInSequenceSequenceSpecial() { //Arrange var spec = new SequenceSpecification(); //Act var result = spec.First(); //Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(ISequenceSpecial)); Assert.IsInstanceOfType(result, typeof(SequenceSpecial)); Assert.AreSame(spec, result.SequenceSpecification); Assert.AreEqual(true, result.FirstInSequence); }
public void ShouldAddATaskToTheTopOfTheSequence() { //Arrange var spec = new SequenceSpecification(); spec.Sequence.Add(new TaskExecutionParameters { TaskType = typeof(TaskBeta) }); spec.Sequence.Add(new TaskExecutionParameters { TaskType = typeof(TaskOmega) }); //Act spec.First <TaskAlpha>(); var result = spec.Sequence; //Assert Assert.AreEqual(3, result.Count); Assert.AreSame(typeof(TaskAlpha), result[0].TaskType); }
public void ShouldSetTheDelayForTheFirstTask() { //Arrange var spec = new SequenceSpecification(); //Act var result = spec.First <TaskAlpha>().DelayStartBy(5) .First <TaskBeta>().DelayStartBy(10).Seconds .First <TaskOmega>().DelayStartBy(15).MilliSeconds .First().TheRest().DelayStartBy(20) .First <TestStartupTask>() .Sequence; //Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(List <TaskExecutionParameters>)); Assert.AreEqual(0, result.First(t => t.TaskType == typeof(TestStartupTask)).Delay); Assert.AreEqual(20, result.First(t => t.TaskType == typeof(IStartupTask)).Delay); Assert.AreEqual(15, result.First(t => t.TaskType == typeof(TaskOmega)).Delay); Assert.AreEqual(10000, result.First(t => t.TaskType == typeof(TaskBeta)).Delay); Assert.AreEqual(5, result.First(t => t.TaskType == typeof(TaskAlpha)).Delay); }