Exemplo n.º 1
0
        protected void Application_Start()
        {
            log4net.Config.XmlConfigurator.Configure();

            RegisterRoutes(RouteTable.Routes);


            RegisterGlobalFilters(GlobalFilters.Filters);

            RegisterViewEngines(ViewEngines.Engines);

            Logger.SetLoggerService(new Log4NetLoggerService());
            Bootstrapper.ConfigureStructureMap(Bootstrapper.ExtensionPath);
            Logger.Info("Application Started");
            Logger.Debug(ObjectFactory.WhatDoIHave());



            ControllerBuilder.Current.SetControllerFactory(
                new ExtensionControllerFactory()
                );

            TenantContext.SetTenantContextProvider(new HttpTenantContextProvider());
            TenantResources.SetTenantResourceProvider(ObjectFactory.GetInstance <NHCachedResourceProvider>());

            ModelBinderProviders.BinderProviders.Add(new XMLModelBinderProvider());
            NHHelper.NHMappingFileRootAssemblyName = "BackToOwner.Golf.Web";
        }
Exemplo n.º 2
0
        public override void Given()
        {
            base.Given();
            var tenantContextProvider = MockRepository.GenerateMock <ITenantContextProvider>();

            tenantContextProvider.Stub(n => n.Language).Return("fr");
            TenantContext.SetTenantContextProvider(tenantContextProvider);

            XmlSerializer serializer = new XmlSerializer(typeof(List <FileResourceProvider.RessourceDictionaryItem>));

            using (FileStream stream = new FileStream(Path, FileMode.OpenOrCreate))
            {
                serializer.Serialize(stream, ResourcesToSerialize);
                stream.Close();
            };
            fileRessourceProvider = new FileResourceProvider();
        }
Exemplo n.º 3
0
        public void Init()
        {
            TenantContext.SetTenantContextProvider(new StubTenantContextProvider());
            TenantResources.SetTenantResourceProvider(new NHCachedResourceProvider(new DefaultCacheService()));

            testResource = new Resource()
            {
                Label    = "testResource",
                Value    = "value for test resource",
                Language = TenantContext.Language
            };
            NHHelper.IsWeb = false;
            NHHelper.ClearCache();
            currentSession = NHHelper.GetSessionFactoryFor("Default").OpenSession();

            CurrentSessionContext.Bind(currentSession);
            tx = currentSession.BeginTransaction();
            currentSession.Save(
                testResource
                );
        }
Exemplo n.º 4
0
        public override void Given()
        {
            base.Given();
            this.StubResourceProvider = MockRepository.GenerateMock <IResourceProvider>();
            this.Resources            = DomainStubFactory.CreateResources();
            this.StubResourceProvider.Stub(n => n.GetResources()).Return(this.Resources);
            TenantContext.SetTenantContextProvider(new StubTenantContextProvider());
            TenantResources.SetTenantResourceProvider(this.StubResourceProvider);

            this.MockedBadgeRepository       = MockRepository.GenerateMock <IRepository <Badge, string> >();
            this.MockedDeclarationRepository = MockRepository.GenerateMock <IRepository <Declaration> >();
            this.MockedMapperService         = MockRepository.GenerateMock <IMapperService>();
            this.MockedSessionService        = MockRepository.GenerateMock <ISessionService>();
            this.MockedSecurityService       = MockRepository.GenerateMock <ISecurityService>();
            this.MockedDistributorService    = MockRepository.GenerateMock <IDistributorService>();
            this.MockedSmsService            = StructureMapMockRepository.RegisterMock <ISmsService>();
            this.MockedMailService           = StructureMapMockRepository.RegisterMock <IMailService>();
            this.MockedAutheticationService  = StructureMapMockRepository.RegisterMock <IAuthenticationService>();
            this.MockedMailFactory           = StructureMapMockRepository.RegisterMock <IMailFactory>();
            this.MockedOwnerRepository       = StructureMapMockRepository.RegisterMock <IRepository <Owner> >();

            this.ApplicationFacade = new ApplicationFacade(this.MockedSessionService, this.MockedDistributorService, this.MockedBadgeRepository, this.MockedDeclarationRepository, this.MockedSecurityService, this.MockedAutheticationService, this.MockedOwnerRepository, this.MockedMapperService);
        }