示例#1
0
        public void ShouldCreateASequenceSpecification()
        {
            //Act
            var result = new SequenceSpecification();

            //Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(ISequenceSpecification));
            Assert.IsInstanceOfType(result, typeof(SequenceSpecification));
        }
示例#2
0
 public ISequenceSpecification TheRest()
 {
     if (FirstInSequence)
     {
         SequenceSpecification.First <IStartupTask>();
     }
     else
     {
         SequenceSpecification.Then <IStartupTask>();
     }
     return(SequenceSpecification);
 }
示例#3
0
        public void ShouldReturnAnEmptySequence()
        {
            //Arrange
            var spec = new SequenceSpecification();

            //Act
            var result = spec.Sequence;

            //Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(List <TaskExecutionParameters>));
            Assert.AreEqual(0, result.Count);
        }
示例#4
0
        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);
        }
示例#5
0
        public void ShouldAddATaskToTheBottomOfTheSequence()
        {
            //Arrange
            var spec = new SequenceSpecification();

            spec.Sequence.Add(new TaskExecutionParameters {
                TaskType = typeof(TaskAlpha)
            });
            spec.Sequence.Add(new TaskExecutionParameters {
                TaskType = typeof(TaskBeta)
            });

            //Act
            spec.Then <TaskOmega>();
            var result = spec.Sequence;

            //Assert
            Assert.AreEqual(3, result.Count);
            Assert.AreSame(typeof(TaskOmega), result[result.Count - 1].TaskType);
        }
示例#6
0
        public void ShouldSetTheDelayForTheMiddleTask()
        {
            //Arrange
            var spec = new SequenceSpecification();

            //Act
            var result = spec.Then <TaskAlpha>().DelayStartBy(5)
                         .Then <TaskBeta>().DelayStartBy(10).Seconds
                         .Then <TaskOmega>().DelayStartBy(15).MilliSeconds
                         .Then().TheRest().DelayStartBy(20)
                         .Then <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);
        }