Пример #1
0
        public void GivenDependencyInjectionNotRegistered_WhenIRegisterDependencyInjection_ThenDependencyResolverUsesWindsor()
        {
            DependencyInjectionConfig.RegisterDependencyInjection();
            IDependencyResolver actual = DependencyResolver.Current;

            Assert.IsInstanceOfType(actual, typeof(WindsorDependencyResolver));
        }
Пример #2
0
        public void GivenDependencyInjectionNotRegistered_WhenIRegisterDependencyInjection_ThenControllerFactoryUsesWindsor()
        {
            DependencyInjectionConfig.RegisterDependencyInjection();
            IControllerFactory actual = ControllerBuilder.Current.GetControllerFactory();

            Assert.IsInstanceOfType(actual, typeof(WindsorControllerFactory));
        }
Пример #3
0
        public void GivenDependencyInjectionNotRegistered_WhenIRegisterDependencyInjection_ThenDependencyResolverChanged()
        {
            IDependencyResolver notExpected = DependencyResolver.Current;

            DependencyInjectionConfig.RegisterDependencyInjection();
            IDependencyResolver actual = DependencyResolver.Current;

            Assert.AreNotEqual(notExpected, actual);
        }
Пример #4
0
        public void GivenDependencyInjectionNotRegistered_WhenIRegisterDependencyInjection_ThenControllerFactoryChanged()
        {
            IControllerFactory notExpected = ControllerBuilder.Current.GetControllerFactory();

            DependencyInjectionConfig.RegisterDependencyInjection();
            IControllerFactory actual = ControllerBuilder.Current.GetControllerFactory();

            Assert.AreNotEqual(notExpected, actual);
        }
Пример #5
0
        public void GivenDependencyInjectionRegistered_WhenIReleaseDependencyInjection_ThenDependencyResolverChanged()
        {
            IControllerFactory  expectedControllerFactory  = ControllerBuilder.Current.GetControllerFactory();
            IDependencyResolver expectedDependencyResolver = DependencyResolver.Current;

            DependencyInjectionConfig.RegisterDependencyInjection();

            DependencyInjectionConfig.ReleaseDependencyInjection();
            IControllerFactory  actualControllerFactory  = ControllerBuilder.Current.GetControllerFactory();
            IDependencyResolver actualDependencyResolver = DependencyResolver.Current;

            Assert.AreEqual(expectedControllerFactory, actualControllerFactory);
            Assert.AreEqual(expectedDependencyResolver, actualDependencyResolver);
        }
 protected void Application_Start()
 {
     if (!RoleEnvironment.IsAvailable)
     {
         throw new InvalidOperationException("This application must run in Windows Azure or the Windows Azure Emulator.");
     }
     Trace.Listeners.Add(new DiagnosticMonitorTraceListener());
     DependencyInjectionConfig.AssemblySearchPath = AppDomain.CurrentDomain.RelativeSearchPath;
     DependencyInjectionConfig.RegisterDependencyInjection();
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     PrepareAuthentication();
 }
 protected void Application_End(object sender, EventArgs e)
 {
     DependencyInjectionConfig.ReleaseDependencyInjection();
 }