public void WhenInvokingPipeline_ThenBehaviorsCanReturnValueWithRefOut() { var expected = new object(); var output = new object(); var byref = new object(); var pipeline = new BehaviorPipeline( new ExecuteHandler((m, n) => m.CreateValueReturn(expected, new object(), byref, output))); NonVoidMethodWithArgRefOutDelegate a = NonVoidMethodWithArgRefOut; var result = pipeline.Invoke(MethodInvocation.Create(this, a.GetMethodInfo(), expected, byref, output)); Assert.Equal(expected, result.ReturnValue); Assert.Equal(byref, result.Outputs.GetValue(0)); Assert.Equal(output, result.Outputs.GetValue(1)); }
public void WhenInvokingPipeline_ThenBehaviorsCanReturnValueWithRefOut() { var expected = new object(); var output = new object(); var byref = new object(); var pipeline = new BehaviorPipeline( new ExecuteDelegate((m, n) => m.CreateValueReturn(expected, new object(), byref, output))); NonVoidMethodWithArgRefOutDelegate a = NonVoidMethodWithArgRefOut; var result = pipeline.Invoke(new MethodInvocation(this, a.GetMethodInfo(), expected, byref, output), new ExecuteDelegate((m, n) => throw new NotImplementedException())); Assert.Equal(expected, result.ReturnValue); Assert.Equal(byref, result.Outputs[0]); Assert.Equal(output, result.Outputs[1]); }