public void Throw_an_exception_if_a_custom_type_doesnt_define_not_operator()
        {
            var target = new Interpreter();

            var x = new TypeWithoutOverloadedBinaryOperators(3);

            target.SetVariable("x", x);

            target.Parse("!x");
        }
        public void Throw_an_exception_if_a_custom_type_doesnt_define_plus_operator()
        {
            var target = new Interpreter();

            var x = new TypeWithoutOverloadedBinaryOperators(3);

            target.SetVariable("x", x);

            int y = 5;

            target.Parse("x + y", new Parameter("y", y));
        }
Beispiel #3
0
        public void Throw_an_exception_if_a_custom_type_doesnt_define_not_operator()
        {
            var target = new Interpreter();

            var x = new TypeWithoutOverloadedBinaryOperators(3);

            target.SetVariable("x", x);

            var ex = Assert.Throws <ParseException>(() => target.Parse("!x"));

            Assert.IsInstanceOf <InvalidOperationException>(ex.InnerException);
        }
        public void Throw_an_exception_if_a_custom_type_doesnt_define_equal_operator()
        {
            var target = new Interpreter();

            var x = new TypeWithoutOverloadedBinaryOperators(3);

            target.SetVariable("x", x);

            var y = "5";

            Assert.Throws <InvalidOperationException>(() => target.Parse("x == y", new Parameter("y", y)));
        }
        public void Throw_an_exception_if_a_custom_type_doesnt_define_plus_operator()
        {
            var target = new Interpreter();

            var x = new TypeWithoutOverloadedBinaryOperators(3);
            target.SetVariable("x", x);

            int y = 5;
            target.Parse("x + y", new Parameter("y", y));
        }
        public void Throw_an_exception_if_a_custom_type_doesnt_define_not_operator()
        {
            var target = new Interpreter();

            var x = new TypeWithoutOverloadedBinaryOperators(3);
            target.SetVariable("x", x);

            target.Parse("!x");
        }