Example #1
0
        public void TestExecuteOnHandler()
        {
            SimpleCommand cmd = new SimpleCommand {
                TestString = "Did it work?"
            };

            ICommandHandler <SimpleCommand> handler = Substitute.For <ICommandHandler <SimpleCommand> >();

            ICommandDispatcher dispatcher = Substitute.For <CommandDispatcherBase>(new Object[] { null });
            ConfiguredCall     call       = dispatcher.Protected("GetCommandHandler", typeof(SimpleCommand)).ReturnsForAnyArgs(handler, null);

            dispatcher.Dispatch <SimpleCommand>(cmd);
            handler.Received(1).Execute(cmd);
        }