public void Null_Service_Locator_Should_Throw_InvalidOperationException()
        {
            var context = Get<IRotorContext>();

            using (Record()) {
                Expect.Call(context.ServiceLocator).Return(null);
            }

            using (Playback()) {
                var blade = new MvcBlade();
                blade.SetupControllerFactory(context);
            }
        }
        public void Resolve_Controller_Factory_Returns_DefaultControllerFactory()
        {
            var contextFake = new Mock<IRotorContext>();
            var locator = new MockControllerFactoryServiceLocator();

            contextFake.Setup(x => x.ServiceLocator)
                .Returns(locator);

            var blade = new MvcBlade();
            blade.SetupControllerFactory(contextFake.Object);

            var currentFactory = ControllerBuilder.Current.GetControllerFactory();
            Assert.IsNotNull(currentFactory);
        }
        public void Resolve_Controller_Factory_Returns_DefaultControllerFactory()
        {
            var context = Get<IRotorContext>();
            var locator = new MockControllerFactoryServiceLocator();

            using (Record()) {
                Expect.Call(context.ServiceLocator).Return(locator);
            }

            using (Playback()) {
                var blade = new MvcBlade();
                blade.SetupControllerFactory(context);
            }

            var currentFactory = ControllerBuilder.Current.GetControllerFactory();
            Assert.IsNotNull(currentFactory);
        }
Exemplo n.º 4
0
        public void Resolve_Controller_Factory_Returns_Null_Which_Implies_TurbineControllerFactory()
        {
            var locator = new MockControllerFactoryServiceLocator()
            {
                ShouldReturnNullForControllerFactory = true
            };

            var contextFake = new Mock<IRotorContext>();
            contextFake.Setup(x => x.ServiceLocator)
                .Returns(locator);

            var blade = new MvcBlade();
            blade.SetupControllerFactory(contextFake.Object);

            var currentFactory = ControllerBuilder.Current.GetControllerFactory();
            Assert.IsNotNull(currentFactory);
            Assert.AreEqual(currentFactory.GetType(), typeof(TurbineControllerFactory));
        }
        public void Resolve_Controller_Factory_Returns_Null_Which_Implies_TurbineControllerFactory()
        {
            var context = Get<IRotorContext>();
            var locator = new MockControllerFactoryServiceLocator()
            {
                ShouldReturnNullForControllerFactory = true
            };

            using (Record()) {
                Expect.Call(context.ServiceLocator).Return(locator);
            }

            using (Playback()) {
                var blade = new MvcBlade();
                blade.SetupControllerFactory(context);
            }

            var currentFactory = ControllerBuilder.Current.GetControllerFactory();
            Assert.IsNotNull(currentFactory);
            Assert.AreEqual(currentFactory.GetType(), typeof(TurbineControllerFactory));
        }
 public void Null_Rotor_Context_Should_Throw_ArgumentNullException()
 {
     var blade = new MvcBlade();
     blade.SetupControllerFactory(null);
 }