コード例 #1
0
ファイル: Extensions.cs プロジェクト: AustinWise/TaxStuff
        public static BaseExpression ExpressionAttributeValue(this XElement el, ParsingEnvironment env, string attributeName)
        {
            XAttribute attr = el.Attribute(attributeName);

            if (attr is null)
            {
                throw new FileLoadException(el, $"Missing {attributeName} attribute");
            }
            try
            {
                return(MyExpressionParser.Parse(env, attr.Value));
            }
            catch (Exception ex)
            {
                throw new FileLoadException(attr, "Failed to parse ValueExpr", ex);
            }
        }
コード例 #2
0
        static void ValidateParse(string input, BaseExpression expectedParse)
        {
            var actual = MyExpressionParser.Parse(null, input);

            Assert.AreEqual(expectedParse, actual, $"\nFrom input '{input}'\nexpected:\n{expectedParse}\nactual:\n{actual}");
        }