Example #1
0
        public static bool TryCreate(string webAddress, out WebAddress result, out string failureReason)
        {
            var specification = new WebAddressSpecification();
            if (specification.IsSatisfiedBy(webAddress))
            {
                result = new WebAddress(webAddress);
                failureReason = string.Empty;
                return true;
            }

            result = null;
            failureReason = specification.GetReasonsForDissatisfactionSeparatedWithNewLine();
            return false;
        }
 private static void AssertSatisfiedSpecification(string value)
 {
     var specification = new WebAddressSpecification();
     Assert.IsTrue(specification.IsSatisfiedBy(value));
     Assert.IsTrue(string.IsNullOrWhiteSpace(specification.GetReasonsForDissatisfactionSeparatedWithNewLine()));
 }