public void GivenDependencyInjectionNotRegistered_WhenIRegisterDependencyInjection_ThenDependencyResolverUsesWindsor() { DependencyInjectionConfig.RegisterDependencyInjection(); IDependencyResolver actual = DependencyResolver.Current; Assert.IsInstanceOfType(actual, typeof(WindsorDependencyResolver)); }
public void GivenDependencyInjectionNotRegistered_WhenIRegisterDependencyInjection_ThenControllerFactoryUsesWindsor() { DependencyInjectionConfig.RegisterDependencyInjection(); IControllerFactory actual = ControllerBuilder.Current.GetControllerFactory(); Assert.IsInstanceOfType(actual, typeof(WindsorControllerFactory)); }
public void GivenDependencyInjectionNotRegistered_WhenIRegisterDependencyInjection_ThenDependencyResolverChanged() { IDependencyResolver notExpected = DependencyResolver.Current; DependencyInjectionConfig.RegisterDependencyInjection(); IDependencyResolver actual = DependencyResolver.Current; Assert.AreNotEqual(notExpected, actual); }
public void GivenDependencyInjectionNotRegistered_WhenIRegisterDependencyInjection_ThenControllerFactoryChanged() { IControllerFactory notExpected = ControllerBuilder.Current.GetControllerFactory(); DependencyInjectionConfig.RegisterDependencyInjection(); IControllerFactory actual = ControllerBuilder.Current.GetControllerFactory(); Assert.AreNotEqual(notExpected, actual); }
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(); }