public void ResolveAsIUsersServiceHandler_WithTeacherHiringModule_DependenciesShouldBeResolved()
        {
            NinjectDependencyResolver resolver = new NinjectDependencyResolver(kernel);
            object resolved = resolver.Resolve <IUsersService>();

            Assert.IsNotNull(resolved);
        }
예제 #2
0
 static void Main()
 {
     NinjectDependencyResolver.Wire(new ServiceModule());
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(NinjectDependencyResolver.Resolve <HomeForm>());
 }
        public void ResolveAsIAlertDisplayer_WithTeacherHiringModule_DependenciesShouldBeResolved()
        {
            NinjectDependencyResolver resolver = new NinjectDependencyResolver(kernel);
            object resolved = resolver.Resolve <IAlertDisplayer>();

            Assert.IsNotNull(resolved);
        }
예제 #4
0
        public void Unresolveable_Should_Return_Null()
        {
            var resolver = new NinjectDependencyResolver();

            var result = resolver.Resolve <IFace1>();

            Assert.IsNull(result);
        }
        public void Array_Injector_Should_Inject_All_Registed_Types()
        {
            var resolver = new NinjectDependencyResolver();
            resolver.RegisterType<IFace1, Class1>();
            resolver.RegisterType<IFace1, Class2>();
            resolver.RegisterInstance<IFace1>(new Class3());

            var resolve = resolver.Resolve<Class4>();
            Assert.AreEqual(3, resolve.Ifaces.Count());
            Assert.IsTrue(resolve.Ifaces.OfType<Class1>().Any());
            Assert.IsTrue(resolve.Ifaces.OfType<Class2>().Any());
            Assert.IsTrue(resolve.Ifaces.OfType<Class3>().Any());
        }
예제 #6
0
        public void Array_Injector_Should_Inject_All_Registed_Types()
        {
            var resolver = new NinjectDependencyResolver();

            resolver.RegisterType <IFace1, Class1>();
            resolver.RegisterType <IFace1, Class2>();
            resolver.RegisterInstance <IFace1>(new Class3());

            var resolve = resolver.Resolve <Class4>();

            Assert.AreEqual(3, resolve.Ifaces.Count());
            Assert.IsTrue(resolve.Ifaces.OfType <Class1>().Any());
            Assert.IsTrue(resolve.Ifaces.OfType <Class2>().Any());
            Assert.IsTrue(resolve.Ifaces.OfType <Class3>().Any());
        }
예제 #7
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            MapperConfig.Configure();
            NinjectDependencyResolver.Resolve();

            var config = GlobalConfiguration.Configuration;

            FluentValidationModelValidatorProvider.Configure(config);

            config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling =
                Newtonsoft.Json.ReferenceLoopHandling.Ignore;
        }
예제 #8
0
파일: Program.cs 프로젝트: lulzzz/leo.v1
        private static StatelessService ServiceFactory(StatelessServiceContext context)
        {
            var kernel = new StandardKernel()
                         .WithBsonIds()
                         .WithActorsClient();

            IDependencyResolver resolver = new NinjectDependencyResolver(kernel);

            kernel.Bind <UsersStreamObserver>().ToSelf().InSingletonScope();
            kernel.Bind <IHubConnectionContext <IUserClient> >()
            .ToMethod(ctx =>
                      resolver.Resolve <IConnectionManager>()
                      .GetHubContext <UserHub, IUserClient>().Clients
                      )
            .WhenInjectedInto <UsersStreamObserver>();

            AppBuilder appBuilder = new DefaultAppBuilder();

            appBuilder = new GoogleOAuth2AppDecorator(appBuilder, kernel.Get <IUserManager>());
            appBuilder = new CorsAppDecorator(appBuilder);
            appBuilder = new SignalRAppDecorator(appBuilder, resolver, kernel, new AuthorizedRequestModule());

            return(new OwinStatelessService(context, appBuilder, "public"));
        }
예제 #9
0
 public UserManager()
 {
     _userDAL = NinjectDependencyResolver.Resolve <IUserDAL>();
 }
예제 #10
0
 public ProductManager()
 {
     _productDAL = NinjectDependencyResolver.Resolve <IProductDAL>();
 }
        public void Unresolveable_Should_Return_Null()
        {
            var resolver = new NinjectDependencyResolver();

            var result = resolver.Resolve<IFace1>();
            Assert.IsNull(result);
        }