Esempio n. 1
0
        public void if_no_return_path_is_specified_look_for_special_element()
        {
            var method      = factory.CreateFrom(typeof(MethodHost).GetMethod("Method"));
            var returnValue = new object();
            var defaults    = Mock <IElementConvention>();

            conventionManager.Expect(x => x.GetElementConvention(typeof(TextBox)))
            .Return(defaults);

            defaults.Expect(x => x.SetValue(host.MethodResult, returnValue));

            var result = binder.CreateResult(
                new MessageProcessingOutcome(
                    returnValue,
                    method.Info.ReturnType,
                    false
                    )
                );

            result.Execute(
                new ResultExecutionContext(
                    Stub <IServiceLocator>(),
                    new FakeMessage(sourceNode, method, string.Empty),
                    handlingNode
                    )
                );
        }
        protected override void given_the_context_of()
        {
            var methodFactory = new DefaultMethodFactory();

            action = new OverloadedAction("Test");

            var infos = typeof(MethodHost)
                        .GetMethods()
                        .Where(x => x.Name == "Test");

            foreach (var info in infos)
            {
                action.AddOverload(
                    new SynchronousAction(
                        Stub <IServiceLocator>(),
                        methodFactory.CreateFrom(info),
                        Stub <IMessageBinder>(),
                        Stub <IFilterManager>(),
                        false
                        )
                    );
            }
        }
        protected override void given_the_context_of()
        {
            var methodFactory = new DefaultMethodFactory();

            action = new OverloadedAction("Test");

            var infos = typeof(MethodHost)
                .GetMethods()
                .Where(x => x.Name == "Test");

            foreach(var info in infos)
            {
                action.AddOverload(
                    new SynchronousAction(
                        Stub<IServiceLocator>(),
                        methodFactory.CreateFrom(info),
                        Stub<IMessageBinder>(),
                        Stub<IFilterManager>(),
                        false
                        )
                    );
            }
        }