private static void AssertTrace(Expression <System.Action> expr, string[] expectedTrace) { var tracer = new ExpressionTracer(); tracer.Compile(expr)(); Assert.Over.Pairs(expectedTrace, tracer.Trace, Assert.AreEqual, "Expression trace should be equal."); }
private static void AssertTrace <TArg, T>(Expression <System.Func <TArg, T> > expr, TArg arg, T expectedValue, string[] expectedTrace) { var tracer = new ExpressionTracer(); T actualValue = tracer.Compile(expr)(arg); Assert.AreEqual(expectedValue, actualValue, "Expression result should be equal."); Assert.Over.Pairs(expectedTrace, tracer.Trace, Assert.AreEqual, "Expression trace should be equal."); }
private static void AssertTrace <T>(Expression <System.Func <T> > expr, T expectedValue, string[] expectedTrace) { using (TestLog.BeginSection(expr.Format())) { var tracer = new ExpressionTracer(); TestLog.WriteLine("Rewritten expression: {0}", tracer.Rewrite(expr).Format()); T actualValue = tracer.Compile(expr)(); Assert.AreEqual(expectedValue, actualValue, "Expression result should be equal."); Assert.Over.Pairs(expectedTrace, tracer.Trace, Assert.AreEqual, "Expression trace should be equal."); } }