예제 #1
0
        public static Task GetNonEmptyTask()
        {
            var task = new Task();

            task.Steps.Add(StepMother.GetNonEmptyStep());
            return(task);
        }
예제 #2
0
        public void AddStep_GivenAStepWithoutPosition_ShouldAddToTheEndOfTask()
        {
            sut.Task = TaskMother.GetNonEmptyTask();
            var step = StepMother.GetNonEmptyStep();

            sut.AddStep(step);
            Assert.That(step.Id, Is.EqualTo(sut[sut.TotalSteps - 1].Id));
        }
예제 #3
0
        public void AppendStep_GivenANonEmptyTask_ShouldAppendStepToTheEndOfTask()
        {
            sut.Task = TaskMother.GetNonEmptyTask();
            var step = StepMother.GetNonEmptyStep();

            sut.AppendStep(step);
            Assert.That(step.Id, Is.EqualTo(sut[sut.TotalSteps - 1].Id));
        }
예제 #4
0
        public void ToggleStepStatus_GivenAUnknowStep_ShouldThrowException()
        {
            var step = StepMother.GetNonEmptyStep();

            sut.AppendStep(step);

            Assert.That(() => sut.ToggleStepStatus(step.Id + 1), Throws.Exception.With.Message.EqualTo(String.Format("No step with Id {0} found.", step.Id + 1)));
        }
예제 #5
0
        public void ToggleStepStatus_GivenACloseStep_ShouldChangeStepToOpen()
        {
            var step = StepMother.GetNonEmptyStep();

            step.Status = StepStatus.Close;
            sut.AppendStep(step);

            sut.ToggleStepStatus(step.Id);
            Assert.That(step.Status, Is.EqualTo(StepStatus.Open));
        }
예제 #6
0
        public void AddStep_GivenAStepWithPosition_ShouldAddTheStepInThatPositionInTaskSteps()
        {
            var step1 = StepMother.GetNonEmptyStep();

            sut.AppendStep(step1);
            var step2 = StepMother.GetNonEmptyStep();

            sut.AppendStep(step2);

            var newStep  = StepMother.GetNonEmptyStep();
            var position = 2;

            sut.AddStep(newStep, position);
            Assert.That(newStep.Id, Is.EqualTo(sut[position - 1].Id));
        }