protected override void Arrange()
            {
                AssemblyLoader.EnsureLoaded <Marker_EdFi_Ods_Test_TestExtension>();
                AssemblyLoader.EnsureLoaded <Marker_EdFi_Ods_Standard>();

                _container = new WindsorContainerEx();

                _container.Register(
                    Component
                    .For <IResourceModelProvider>()
                    .ImplementedBy <ResourceModelProvider>());

                _container.Register(
                    Component.For <IExtensionNHibernateConfigurationProvider>()
                    .ImplementedBy <ExtensionNHibernateConfigurationProvider>());

                _container.Register(
                    Component.For <IFilterCriteriaApplicatorProvider>()
                    .ImplementedBy <FilterCriteriaApplicatorProvider>());

                _container.Register(Component.For <IOrmMappingFileDataProvider>()
                                    .UsingFactoryMethod(kernel => new OrmMappingFileDataProvider(kernel.Resolve <IAssembliesProvider>(), DatabaseEngine.SqlServer, "EdFi.Ods.Standard"))
                                    );

                _container.Register(Component.For <IAssembliesProvider>().ImplementedBy <AssembliesProvider>());
            }
Пример #2
0
            public void SetUp()
            {
                var container = new WindsorContainerEx();

                container.Install(new SecurityComponentsInstaller());

                container.Register(
                    Component
                    .For(typeof(IGetEntityByKey <>))
                    .ImplementedBy(typeof(DecoratedGetEntityByKey <>))
                    .OnCreate((kernel, item) => DecoratedGetEntityByKeyInstance = (DecoratedGetEntityByKey <Student>)item));

                container.Register(
                    Component
                    .For(typeof(IRelationshipsAuthorizationContextDataProvider <>))
                    .ImplementedBy(typeof(RelationshipsAuthorizationContextDataProviderStub <>))   //,
                    );

                resolvedIGetEntityByKey = container.Resolve <IGetEntityByKey <Student> >();
            }
        public static WindsorContainerEx GetWindsorContainer()
        {
            var container = new WindsorContainerEx();

            container.AddSupportForEmptyCollections();

            container.Register(
                Component
                .For <ISchoolYearContextProvider>()
                .ImplementedBy <StubCurrentSchoolYearContextProvider>());

            container.Register(
                Component
                .For <IETagProvider>()
                .ImplementedBy <StubEtagProviderSinceWeReallyDontCareWhatTheValueIs>());

            container.Register(
                Classes.FromThisAssembly()
                .BasedOn(typeof(IStep <,>)));

            return(container);
        }
Пример #4
0
        public void Container_Should_Allow_WindsorContainerEx_Dependency_To_Be_Registered()
        {
            var container = new WindsorContainerEx();

            container.Register(
                Component.For <ServiceLocatorDependencyTestClass>()
                .DependsOn(Dependency.OnValue <IServiceLocator>(container))
                );

            var obj = container.Resolve <ServiceLocatorDependencyTestClass>();

            Assert.IsTrue(obj.HasValidLocator());
        }
Пример #5
0
        public static void Initialize(
            IOAuthTokenValidator oAuthTokenValidator       = null,
            IApiKeyContextProvider apiKeyContextProvider   = null,
            IClaimsIdentityProvider claimsIdentityProvider = null,
            IConfigValueProvider configValueProvider       = null)
        {
            _container = new WindsorContainerEx();

            //arrange
            var tokenValidator   = oAuthTokenValidator ?? MockRepository.GenerateStub <IOAuthTokenValidator>();
            var contextProvider  = apiKeyContextProvider ?? MockRepository.GenerateStub <IApiKeyContextProvider>();
            var identityProvider = claimsIdentityProvider ?? MockRepository.GenerateStub <IClaimsIdentityProvider>();
            var configProvider   = configValueProvider ?? MockRepository.GenerateStub <IConfigValueProvider>();

            _container.Register(
                Component.For <IOAuthTokenValidator>()
                .Instance(tokenValidator));

            _container.Register(
                Component.For <IApiKeyContextProvider>()
                .Instance(contextProvider));

            _container.Register(
                Component.For <IClaimsIdentityProvider>()
                .Instance(identityProvider));

            _container.Register(
                Component.For <IConfigValueProvider>()
                .Instance(configProvider));

            _container.Register(
                Component.For <IAuthenticationProvider>()
                .ImplementedBy <OAuthAuthenticationProvider>());

            // Web API Dependency Injection
            _container.Register(
                Component.For <IDependencyResolver>()
                .Instance(new WindsorDependencyResolver(_container)));
        }
Пример #6
0
        public void Container_Should_Not_Allow_WindsorContainerEx_To_Be_Registered()
        {
            var container = new WindsorContainerEx();

            Should.Throw <Exception>(() => container.Register(Component.For <WindsorContainerEx>()));
        }