Exemplo n.º 1
0
        public void CanResolveHomeController()
        {
            //Arrange
            var windsorContainer = new WindsorContainer();
            windsorContainer.Configure();
            var resolver = new WindsorDependencyResolver(new WindsorIoCContainer(windsorContainer));
            DependencyResolver.SetResolver(resolver);
            IControllerActivator controllerActivator = new StandardControllerActivator();

            //Act
            IController controller = controllerActivator.Create(null, typeof (HomeController));

            //Assert
            Assert.IsNotNull(controller);
        }
Exemplo n.º 2
0
        public void ControllerActivatorRequiresDependencyResolverToFunction()
        {
            //Arrange
            IControllerActivator activator = new StandardControllerActivator();
            DependencyResolver.SetResolver(new NullTestResolver());
            //Act
            activator.Create(null, typeof (HomeController));

            //Assert
            Assert.Fail("If it made it to here then someone removed the pointer to the dependency resolver");
        }