Exemple #1
0
        public void ParseInvalidIdentifier()
        {
            var t_Rule       = new IdentifierRule();
            var t_Expression = t_Rule.Match(CreateState(new Token(TokenType.Operator, "+")));

            t_Expression
            .HasError()
            .Should()
            .BeTrue();
        }
Exemple #2
0
        /// <summary>
        /// Derives a <b>UPI</b> from the values in the product infoset
        /// represented by the indicated DOM <see cref="XmlElement"/> based on the
        /// target product taxonomy classification.
        /// </summary>
        /// <param name="infoset">The root <see cref="XmlElement"/> of the product infoset.</param>
        /// <param name="productType">The target product taxonomy classification.</param>
        /// <returns>The derived <b>UPI</b> instance or <c>null</c>.</returns>
        public static UPI ForProductInfoset(XmlElement infoset, Category productType)
        {
            if (productType != null)
            {
                IdentifierRule rule = ruleBook.Find(productType.Name);

                return((rule != null) ? new UPI(rule.GetIdentifier(infoset)) : null);
            }
            return(null);
        }
Exemple #3
0
        public void ParseIdentifier()
        {
            var t_Rule       = new IdentifierRule();
            var t_Expression = t_Rule.Match(CreateState(new Token(TokenType.Identifier, "RAM")));

            t_Expression
            .HasError()
            .Should()
            .BeFalse();
            t_Expression.Value.Expressions.First()
            .Should()
            .BeOfType <IdentifierExpression>();
            ((IdentifierExpression)t_Expression.Value.Expressions.First())
            .Identifier
            .Text
            .Should()
            .Be("RAM");
        }