// // 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()); }
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()); }