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); } }
public void WhenPassedStringWithNonDigitsReturnsTrue(string testNumberString) { var validator = new TelephoneNumberValidator(); var result = validator.Validate(testNumberString); result.ShouldBe(false); }
public void WhenPassedValidNumberStringWithDashesReturnsTrue(string testNumberString) { var validator = new TelephoneNumberValidator(); var result = validator.Validate(testNumberString); result.ShouldBe(true); }
public void WhenPassedNumbersOutsideLengthRangeReturnsFalse(string testNumberString) { var validator = new TelephoneNumberValidator(); var result = validator.Validate(testNumberString); result.ShouldBe(false); }