public void CompositionRoot_ShouldBeAbleToBuildAllRootTypes() { // Arrange NinjectWebCommon.Start(); AutoMapConfig.RegisterMappings(); var writer = new HtmlTextWriter(TextWriter.Null); var req = new HttpRequest("/asd.png", "http://localhost/asd.png", ""); var res = new HttpResponse(writer); var httpContext = new HttpContext(req, res); HttpContext.Current = httpContext; var owinEnv = new Dictionary <string, object> { { $"{IdentityOwinPrefix}{typeof(IApplicationUserManager).AssemblyQualifiedName}", new Mock <IApplicationUserManager>().Object }, { $"{IdentityOwinPrefix}{typeof(IApplicationSignInManager).AssemblyQualifiedName}", new Mock <IApplicationSignInManager>().Object } }; httpContext.Items[OwinEnvironmentKey] = owinEnv; var mvcAssembly = typeof(HomeController).Assembly; var rootTypes = mvcAssembly.GetExportedTypes() .Where(type => typeof(IController).IsAssignableFrom(type) || typeof(IHub).IsAssignableFrom(type)) .Where(type => !type.IsAbstract && !type.IsGenericTypeDefinition) .Where(type => type.Name.EndsWith("Controller") || type.Name.EndsWith("Hub")); // Act & Assert foreach (var type in rootTypes) { Assert.DoesNotThrow(() => NinjectWebCommon.Kernel.Get(type)); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); NinjectWebCommon.Start(); Database.SetInitializer <EFDbContext>(null); ModelBinders.Binders.Add(typeof(Cart), new CartModelBinder()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); NinjectWebCommon.Start(); }
public void SetupControllerBase() { NinjectWebCommon.Start(); MappingConfiguration.Start(); var config = GlobalConfiguration.Configuration.DependencyResolver; Controller = (T)Convert.ChangeType(config.GetService(typeof(T)), typeof(T)); if (Controller == null) { return; } Controller.Request = new HttpRequestMessage(); Controller.Request.SetConfiguration(new HttpConfiguration()); }
public static void Start() { NinjectWebCommon.Start(new DataModule()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); NinjectWebCommon.Start(); }
public static void ClassStartKernel(TestContext context) { NinjectWebCommon.Start(); Utils.GetAgencyData(); }
protected void Application_Start() { GlobalConfiguration.Configure(WebApiConfig.Register); AutoMapperConfig.RegisterMappings(); NinjectWebCommon.Start(); }
public Form1() { InitializeComponent(); NinjectWebCommon.Start(); }
public static void ClassStartKernel(TestContext context) { AnalyzeSelectedAssemblies(); NinjectWebCommon.Start(); }
public static void ClassStartKernel(TestContext context) { NinjectWebCommon.Start(); }