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)); } }