コード例 #1
0
        public void IsSatisfiedBy(string input, bool expected)
        {
            var  specification = new PhoneNumberSpecification();
            bool actual        = specification.IsSatisfiedBy(input);

            Assert.Equal(expected, actual);
        }
コード例 #2
0
        protected override bool IsValid(PropertyValidatorContext context)
        {
            var stringToValidate = context.PropertyValue as string;

            if (string.IsNullOrEmpty(stringToValidate))
            {
                return(true);
            }

            var specification = new PhoneNumberSpecification();

            return(specification.IsSatisfiedBy(stringToValidate));
        }
コード例 #3
0
 private static void AssertDissatisfiedSpecification(string phoneNumber)
 {
     var specification = new PhoneNumberSpecification();
     Assert.IsFalse(specification.IsSatisfiedBy(phoneNumber));
     Assert.IsFalse(string.IsNullOrWhiteSpace(specification.GetReasonsForDissatisfactionSeparatedWithNewLine()));
 }