Ejemplo n.º 1
0
        public void WhenInvokingPipeline_ThenBehaviorsCanReturnValueWithOut()
        {
            var expected = new object();
            var output   = new object();

            var pipeline = new BehaviorPipeline(
                new ExecuteHandler((m, n) => m.CreateValueReturn(expected, new object(), output)));

            NonVoidMethodWithArgOutDelegate a = NonVoidMethodWithArgOut;

            var result = pipeline.Invoke(MethodInvocation.Create(this, a.GetMethodInfo(), expected, output));

            Assert.Equal(expected, result.ReturnValue);
            Assert.Equal(output, result.Outputs.GetValue(0));
        }
Ejemplo n.º 2
0
        public void WhenInvokingPipeline_ThenBehaviorsCanReturnValueWithOut()
        {
            var expected = new object();
            var output   = new object();

            var pipeline = new BehaviorPipeline(
                new ExecuteDelegate((m, n) => m.CreateValueReturn(expected, new object(), output)));

            NonVoidMethodWithArgOutDelegate a = NonVoidMethodWithArgOut;

            var result = pipeline.Invoke(new MethodInvocation(this, a.GetMethodInfo(), expected, output),
                                         new ExecuteDelegate((m, n) => throw new NotImplementedException()));

            Assert.Equal(expected, result.ReturnValue);
            Assert.Equal(output, result.Outputs[0]);
        }