コード例 #1
0
        public void Can_Validate_If_Today_Is_Birthday_For_Not_Current_Date_In_Valid_Format()
        {
            //ARRANGE
            var birthdayValidator = new BirthdayValidator();
            var notCurrentDateTimeInValidFormat = GenerateDateThatIsNotCurrentDate().ToString("dd/MM/yyyy");
            //ACT
            var result = birthdayValidator.ValidateIfTodayIsPersonBirthday(notCurrentDateTimeInValidFormat);

            //ASSERT
            Assert.False(result);
        }
コード例 #2
0
        public void Can_Validate_If_Today_Is_Birthday_For_Current_Date_In_Different_Format()
        {
            //ARRANGE
            var birthdayValidator = new BirthdayValidator();
            var currentDateTimeInDifferentFormat = DateTime.UtcNow.ToString("dd-MM-yyyy");
            //ACT
            var result = birthdayValidator.ValidateIfTodayIsPersonBirthday(currentDateTimeInDifferentFormat);

            //ASSERT
            Assert.True(result);
        }
コード例 #3
0
        public void Can_Validate_As_False_If_Today_Is_Birthday_For_String_That_Is_Not_Date()
        {
            //ARRANGE
            var birthdayValidator = new BirthdayValidator();
            var notDateTimeString = "word";
            //ACT

            var result = birthdayValidator.ValidateIfTodayIsPersonBirthday(notDateTimeString);

            //ASSERT
            Assert.False(result);
        }
        private bool ValidateIfTodayIsSomeonesBirthday(string dateToValidate)
        {
            var birthdayValidator = new BirthdayValidator();

            return(birthdayValidator.ValidateIfTodayIsPersonBirthday(dateToValidate));
        }