Example #1
0
        protected override void Before_each_spec()
        {
            _command = Create<HelpCommand>();

             _container = Mock<IWindsorContainer>();
             Locator.InitializeContainer(_container);

             SetupResult.For(_container.Resolve<ICommand>("fake-command-1"))
            .Throw(new ComponentNotFoundException(typeof (ICommand)));
        }
Example #2
0
        protected override void Before_each_spec()
        {
            _command = Create<HelpCommand>();

             _container = Mock<IWindsorContainer>();
             Locator.InitializeContainer(_container);

             _commandWeWantHelpFor = new FakeCommand1();

             SetupResult.For(_container.Resolve<ICommand>("fake-command-1")).Return(_commandWeWantHelpFor);

             _argumentMap = Mock<IArgumentMap>();
             SetupResult.For(Get<IArgumentMapFactory>().CreateMap(_commandWeWantHelpFor)).Return(_argumentMap);
             SetupResult.For(_argumentMap.Usage).Return("usage");
        }
Example #3
0
        protected override void Before_each_spec()
        {
            _command = Create<HelpCommand>();

             _container = Mock<IWindsorContainer>();
             _kernel = Mock<IKernel>();
             SetupResult.For(_container.Kernel).Return(_kernel);
             Locator.InitializeContainer(_container);

             _handlerForFakeCommand1 = Mock<IHandler>();
             _handlerForFakeCommand2 = Mock<IHandler>();

             SetupResult.For(_handlerForFakeCommand1.ComponentModel).Return(
            new ComponentModel("fake-command-1", typeof (ICommand), typeof (FakeCommand1)));
             SetupResult.For(_handlerForFakeCommand1.Resolve(null)).Return(new FakeCommand1());
             LastCall.IgnoreArguments();

             SetupResult.For(_handlerForFakeCommand2.ComponentModel).Return(
            new ComponentModel("fake-command-2", typeof (ICommand), typeof (FakeCommand2)));
             SetupResult.For(_handlerForFakeCommand2.Resolve(null)).Return(new FakeCommand2());
             LastCall.IgnoreArguments();

             _handlers = new List<IHandler>();
             _handlers.Add(_handlerForFakeCommand1);
             _handlers.Add(_handlerForFakeCommand2);
        }