public void DefaultValidation_TopicThatIsNull_ShouldThrowException() { ITopicValidator topicValidator = new TopicValidator(); Action action = () => topicValidator.DefaultValidation(null as Topic); action.Should().Throw <NullReferenceException>().WithMessage("Topic can not be null"); }
public void DefaultValidation_NameIsEmptyOrNull_ShouldThrowException() { ITopicValidator topicValidator = new TopicValidator(); Action action = () => topicValidator.DefaultValidation(new Topic() { Comments = new List <Comment>(), Course = new Course(), MainBody = "" }); action.Should().Throw <ArgumentException>().WithMessage("Topic Name must not be empty"); }
public void DefaultValidation_MainBodyThatIsNull_ShouldThrowException() { ITopicValidator topicValidator = new TopicValidator(); Action action = () => topicValidator.DefaultValidation(new Topic() { Comments = new List <Comment>(), Course = new Course(), Name = "" }); action.Should().Throw <NullReferenceException>().WithMessage("Topic MainBody must be initialized"); }
public void DefaultValidation_CourseThatIsNull_ShouldThrowException() { ITopicValidator topicValidator = new TopicValidator(); Action action = () => topicValidator.DefaultValidation(new Topic() { Comments = new List <Comment>(), MainBody = "", Name = "" }); action.Should().Throw <NullReferenceException>().WithMessage("Topic must have a Course"); }