public void TestItInternalInternal <T, TRet>(Expression <T> expr, Func <T, TRet> howToCall, ISimpleSerializer serializer)
        {
            var expr1 = EditableExpression.Create(Funcletizer.PartialEval(expr));

            byte[]             data  = serializer.Serialize(expr1);
            EditableExpression expr2 = (EditableExpression)serializer.Deserialize(data);
            T func2 = ((Expression <T>)expr2.ToExpression()).Compile();

            var value1 = howToCall(func2);
            var value2 = howToCall(expr.Compile());

            Assert.AreEqual(value2, value1);
        }
示例#2
0
 public static T RoundTrip <T>(this ISimpleSerializer serializer, T graph)
 {
     return((T)serializer.Deserialize(serializer.Serialize(graph)));
 }