public void TestThatParameterlessExpressionInvokes() { Expression <Action <IParameterlessInterface> > expression = a => a.DoSomething(); var serialized = ExpressionSerialization.Serialize(expression); var actor = new ActorTest(); var serializationInfo = ExpressionSerialization.Deserialize(serialized); var consumer = ExpressionExtensions.CreateDelegate <IParameterlessInterface>(actor, serializationInfo); consumer(actor); Assert.True(actor.WasRun); }
public void TestThatSimpleParameterExpressionInvokes() { var message = "hello"; var i = 10; Expression <Action <ISimpleParametersInterface> > expression = a => a.DoSomething(message, i); var serialized = ExpressionSerialization.Serialize(expression); var actor = new ActorTest(); var serializationInfo = ExpressionSerialization.Deserialize(serialized); var consumer = ExpressionExtensions.CreateDelegate <ISimpleParametersInterface>(actor, serializationInfo); consumer(actor); Assert.Equal(i, actor.Count); Assert.Equal(message, actor.Message); }
public void TestThatSimpleExpressionInvokes() { var actor = new ActorTest(); var m = "Test"; Expression <Action <int> > expression = i => actor.DoSomething(m, i); var serialized = ExpressionSerialization.Serialize(expression); var serializationInfo = ExpressionSerialization.Deserialize(serialized); var consumer = ExpressionExtensions.CreateDelegate <IParameterlessInterface, int>(actor, serializationInfo); consumer(actor, 100); Assert.Equal(100, actor.Count); Assert.Equal(m, actor.Message); }
public void TestThatComplexParameterExpressionInvokes() { var i = 10; var complexParameters = new ComplexParameters { Int = 1, Message = "Hello", InnerParameters = new ComplexParameters { Int = 2, Message = "World" } }; Expression <Action <IComplexParameterInterface> > expression = a => a.DoSomething(i, complexParameters); var serialized = ExpressionSerialization.Serialize(expression); var actor = new ActorTest(); var serializationInfo = ExpressionSerialization.Deserialize(serialized); var consumer = ExpressionExtensions.CreateDelegate <IComplexParameterInterface>(actor, serializationInfo); consumer(actor); Assert.Equal(i, actor.Count); Assert.Equal(complexParameters, actor.Parameters); }