예제 #1
0
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // <ClassInitialize()> Public Shared Sub MyClassInitialize(ByVal testContext As TestContext)
        // End Sub
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // <ClassCleanup()> Public Shared Sub MyClassCleanup()
        // End Sub
        //
        // Use TestInitialize to run code before running each test
        // <TestInitialize()> Public Sub MyTestInitialize()
        // End Sub
        //
        // Use TestCleanup to run code after each test has run
        // <TestCleanup()> Public Sub MyTestCleanup()
        // End Sub
        //
        #endregion

        private void AssertEval(string expr, long result)
        {
            ExpressionEvaluator ee     = new ExpressionEvaluator();
            ExpressionValue     actual = null;

            Assert.True(ee.TryEvaluate(expr, out actual));
            Assert.Equal(result, actual.ConvertToLong());
        }
예제 #2
0
        private static bool Equals(ExpressionValue left, ExpressionValue right)
        {
            if (right.Kind == ExpressionValueKind.Single || right.Kind == ExpressionValueKind.Double)
            {
                return(left.ConvertToDouble() == right.ConvertToDouble());
            }

            return(left.ConvertToLong() == right.ConvertToLong());
        }