Ejemplo n.º 1
0
        public void TestSiblingsBeforeSelf_MissingChild()
        {
            var a = new VariableUse()
            {
                Name = "a"
            };
            var plus = new OperatorUse()
            {
                Text = "+"
            };
            var foo = new VariableUse()
            {
                Name = "foo"
            };
            var times = new OperatorUse()
            {
                Text = "*"
            };
            var b = new VariableUse()
            {
                Name = "b"
            };
            var exp = new Expression();

            exp.AddComponents(new Expression[] { a, plus, foo, times, b });

            var dot = new OperatorUse {
                Text             = ".",
                ParentExpression = exp
            };

            Assert.Throws <InvalidOperationException>(() => dot.GetSiblingsBeforeSelf());
        }
Ejemplo n.º 2
0
        public void TestSiblingsBeforeSelf_MissingChild() {
            var a = new VariableUse() { Name = "a" };
            var plus = new OperatorUse() { Text = "+" };
            var foo = new VariableUse() { Name = "foo" };
            var times = new OperatorUse() { Text = "*" };
            var b = new VariableUse() { Name = "b" };
            var exp = new Expression();
            exp.AddComponents(new Expression[] { a, plus, foo, times, b });

            var dot = new OperatorUse {
                Text = ".",
                ParentExpression = exp
            };

            Assert.Throws<InvalidOperationException>(() => dot.GetSiblingsBeforeSelf());
        }