コード例 #1
0
        public void TestCaseEvaluationExceptions()
        {
            var @operator = new LogicalAndOperator(TypeConverter);

            ExpectArgumentNullException("context", () => @operator.Evaluate(null, 1, 2));
            ExpectArgumentNullException("context", () => @operator.EvaluateLhs(null, 1, out object dummy));
        }
コード例 #2
0
        public void TestCaseLhsEvaluation()
        {
            var @operator = new LogicalAndOperator(TypeConverter);

            Assert.IsFalse(@operator.EvaluateLhs(EmptyEvaluationContext, true, out object result));
            Assert.IsTrue(@operator.EvaluateLhs(EmptyEvaluationContext, false, out result) && result.Equals(false));
        }
コード例 #3
0
        public void TestCaseConstruction3()
        {
            var @operator = new LogicalAndOperator("operator", TypeConverter);

            Assert.AreEqual("operator", @operator.Symbol);
            Assert.AreEqual(11, @operator.Precedence);
            Assert.AreEqual(Associativity.LeftToRight, @operator.Associativity);
        }
コード例 #4
0
        public void TestCaseEvaluation()
        {
            var @operator = new LogicalAndOperator(TypeConverter);

            AssertEvaluation <bool>(@operator, true, true, true);
            AssertEvaluation <bool>(@operator, true, false, false);
            AssertEvaluation <bool>(@operator, false, true, false);
            AssertEvaluation <bool>(@operator, false, false, false);
        }
コード例 #5
0
 public virtual void Visit(LogicalAndOperator binaryOperator)
 {
     Visit(binaryOperator.Left);
     Visit(binaryOperator.Right);
 }
コード例 #6
0
        public void TestCaseConstruction2()
        {
            var @operator = new LogicalAndOperator(TypeConverter);

            Assert.AreEqual("&&", @operator.Symbol);
        }
コード例 #7
0
 public override void Visit(LogicalAndOperator binaryOperator)
 {
     WriteBinaryExpression(binaryOperator, "&&");
 }
コード例 #8
0
 public override void Visit(LogicalAndOperator binaryOperator)
 {
     Visit(binaryOperator.Left);
     Write(" && ");
     Visit(binaryOperator.Right);
 }