コード例 #1
0
        public void TelephoneNumberValidator_validate(string telephoneNumber, bool shouldBeValid)
        {
            var sut = new TelephoneNumberValidator();

            if (shouldBeValid)
            {
                Assert.IsTrue(sut.Validate(PopulateTelephoneViewModel(telephoneNumber)).IsValid);
            }
            else
            {
                Assert.IsFalse(sut.Validate(PopulateTelephoneViewModel(telephoneNumber)).IsValid);
            }
        }
コード例 #2
0
        public void WhenPassedStringWithNonDigitsReturnsTrue(string testNumberString)
        {
            var validator = new TelephoneNumberValidator();

            var result = validator.Validate(testNumberString);

            result.ShouldBe(false);
        }
コード例 #3
0
        public void WhenPassedValidNumberStringWithDashesReturnsTrue(string testNumberString)
        {
            var validator = new TelephoneNumberValidator();

            var result = validator.Validate(testNumberString);

            result.ShouldBe(true);
        }
コード例 #4
0
        public void WhenPassedNumbersOutsideLengthRangeReturnsFalse(string testNumberString)
        {
            var validator = new TelephoneNumberValidator();

            var result = validator.Validate(testNumberString);

            result.ShouldBe(false);
        }