示例#1
0
        private static NamespaceDependencyRule ParseDependencyRule(XElement xElement)
        {
            var fromValue = GetAttributeValue(xElement, FromAttributeName);

            if (fromValue == null)
            {
                throw new Exception($"{GetLineInfo(xElement)}'{FromAttributeName}' attribute missing.");
            }

            var toValue = GetAttributeValue(xElement, ToAttributeName);

            if (toValue == null)
            {
                throw new Exception($"{GetLineInfo(xElement)}'{ToAttributeName}' attribute missing.");
            }

            var fromNamespaceSpecification = TryAndReportError(xElement, () => NamespaceSpecificationParser.Parse(fromValue.Trim()));
            var toNamespaceSpecification   = TryAndReportError(xElement, () => NamespaceSpecificationParser.Parse(toValue.Trim()));

            return(new NamespaceDependencyRule(fromNamespaceSpecification, toNamespaceSpecification));
        }
示例#2
0
 public DependencyRule(string from, string to)
     : this(NamespaceSpecificationParser.Parse(from), NamespaceSpecificationParser.Parse(to))
 {
 }
 public void Parse_Invalid(string invalidString)
 {
     Assert.Throws <FormatException>(() => NamespaceSpecificationParser.Parse(invalidString));
 }
示例#4
0
        private static int MatchRelevance(string namespaceSpecificationAsString, string namespaceAsString)
        {
            var ns = new Namespace(namespaceAsString);

            return(NamespaceSpecificationParser.Parse(namespaceSpecificationAsString).GetMatchRelevance(ns));
        }
 public void Parse_NamespaceTree(string namespaceTreeString)
 {
     NamespaceSpecificationParser.Parse(namespaceTreeString).Should().Be(new NamespaceTree(namespaceTreeString));
 }