public void TestCaseEvaluationExceptions()
        {
            var @operator = new SequenceOperator(TypeConverter);

            ExpectArgumentNullException("context", () => @operator.Evaluate(null, 1, 2));
            ExpectArgumentNullException("context", () => @operator.EvaluateLhs(null, 1, out object dummy));
        }
Beispiel #2
0
        public TextLogger()
        {
            _opGenericType = new SequenceOperator(nameof(_opGenericType));
            _opGenericType.OperationErrorOccurred += OnOperationErrorOccurred;

            _op = new SequenceOperator(nameof(_op));
            _op.OperationErrorOccurred += OnOperationErrorOccurred;
        }
        public void TestCaseConstruction3()
        {
            var @operator = new SequenceOperator("operator", TypeConverter);

            Assert.AreEqual("operator", @operator.Symbol);
            Assert.AreEqual(2, @operator.Precedence);
            Assert.AreEqual(Associativity.LeftToRight, @operator.Associativity);
        }
        public void TestCaseEvaluation()
        {
            var @operator = new SequenceOperator(TypeConverter);

            var enumerable = @operator.Evaluate(EmptyEvaluationContext, 1.8, 2.1) as IEnumerable <int>;

            Assert.IsNotNull(enumerable);
            Assert.AreEqual("1,2", string.Join(",", enumerable));

            enumerable = @operator.Evaluate(EmptyEvaluationContext, 1.1, 1.8) as IEnumerable <int>;
            Assert.IsNotNull(enumerable);
            Assert.AreEqual("1", string.Join(",", enumerable));

            enumerable = @operator.Evaluate(EmptyEvaluationContext, 2, 1) as IEnumerable <int>;
            Assert.IsNull(enumerable);
        }
        public void TestCaseConstruction2()
        {
            var @operator = new SequenceOperator(TypeConverter);

            Assert.AreEqual("..", @operator.Symbol);
        }