示例#1
0
        public void DeadlinePostValidation_DateFromThePast_ShouldReturnError()
        {
            // Arrange
            var validator    = new DeadlinePostValidator();
            var deadlinePost = TestData.Deadline.CreateDeadlinePost();

            deadlinePost.Date = DateTime.Today.AddDays(-1);
            // Act
            var result = validator.TestValidate(deadlinePost);

            // Assert
            result.IsValid.Should().BeFalse();
            result.ShouldHaveValidationErrorFor(a => a.Date.Date);
        }
示例#2
0
        public void DeadlinePostValidation_EmptyText_ShouldReturnError()
        {
            // Arrange
            var validator    = new DeadlinePostValidator();
            var deadlinePost = TestData.Deadline.CreateDeadlinePost();

            deadlinePost.Name = string.Empty;
            // Act
            var result = validator.TestValidate(deadlinePost);

            // Assert
            result.IsValid.Should().BeFalse();
            result.ShouldHaveValidationErrorFor(a => a.Name);
        }