예제 #1
0
        public void ValidateInput_WithTaskDescLength_ShouldThrowException()
        {
            var    taskValidator = new TaskValidator();
            Action action        = () => taskValidator.ValidateTask(new Task()
            {
                Id = 1, AssigneeId = 1, Assignee = new Assignee()
                {
                    Id = 1, Name = "Dave"
                }, Description = "AYY", DueDate = DateTime.Now
            });

            action.Should().Throw <InvalidDataException>().WithMessage("Task description has to be at least 5 characters long");
        }
예제 #2
0
        public void ValidateInput_WithTaskDescriptionNull_ShouldThrowException()
        {
            var    taskValidator = new TaskValidator();
            Action action        = () => taskValidator.ValidateTask(new Task()
            {
                Id = 1, AssigneeId = 1, Assignee = new Assignee()
                {
                    Id = 1, Name = "Dave"
                }, DueDate = DateTime.Now
            });

            action.Should().Throw <InvalidDataException>().WithMessage("Task must have a description");
        }
예제 #3
0
        public void CanThrowAnExceptionOnNullStuff()
        {
            var simpleTask = new TestTask(null, "echo {}");

            TaskValidator.ValidateTask(simpleTask);
        }
예제 #4
0
        public void CanThrowAnExceptionOnEmptyParameters()
        {
            var simpleTask = new TestTask("");

            TaskValidator.ValidateTask(simpleTask);
        }