public void Init()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <UrlRuleProvider>().As <IRuleProvider>();
            _stubContextAccessor = new StubHttpContextAccessor();
            builder.RegisterInstance(_stubContextAccessor).As <IHttpContextAccessor>();
            _container       = builder.Build();
            _urlRuleProvider = _container.Resolve <IRuleProvider>();
        }
Пример #2
0
 public void Init() {
     var builder = new ContainerBuilder();
     _shellSettings = new ShellSettings {RequestUrlPrefix = string.Empty};
     builder.RegisterType<UrlRuleProvider>().As<IRuleProvider>();
     builder.RegisterInstance(_shellSettings);
     _stubContextAccessor = new StubHttpContextAccessor();
     builder.RegisterInstance(_stubContextAccessor).As<IHttpContextAccessor>();
     _container = builder.Build();
     _urlRuleProvider = _container.Resolve<IRuleProvider>();
 }
Пример #3
0
        public override void Register(ContainerBuilder builder)
        {
            builder.RegisterType <DefaultSslSettingsProvider>().As <ISslSettingsProvider>();
            builder.RegisterType <VerifyCodeGenerator>().As <IVerifyCodeGenerator>();
            builder.RegisterType <QCloudSMSHelper>().As <ISMSHelper>();
            builder.RegisterType <DefaultEncryptionService>().As <IEncryptionService>();
            builder.RegisterType <MerchantService>().As <IMerchantService>();
            builder.RegisterType <EnjoyAuthService>().As <IEnjoyAuthService>();
            builder.RegisterType <QCloudSMSHelper>().As <ISMSHelper>();
            builder.RegisterType <VerifyCodeGenerator>().As <IVerifyCodeGenerator>();
            builder.RegisterType <WeChatApi>().As <IWeChatApi>();
            builder.RegisterType <OrchardServices>().As <IOrchardServices>();
            builder.RegisterType <DefaultContentManager>().As <IContentManager>();
            builder.RegisterType <StubCacheManager>().As <ICacheManager>();
            builder.RegisterType <Signals>().As <ISignals>();
            builder.RegisterType <DefaultContentManagerSession>().As <IContentManagerSession>();
            builder.RegisterInstance(new Mock <IContentDefinitionManager>().Object);
            builder.RegisterInstance(new Mock <IAuthorizer>().Object);
            builder.RegisterInstance(new Mock <INotifier>().Object);
            builder.RegisterInstance(new Mock <IContentDisplay>().Object);
            builder.RegisterInstance(new Mock <IAuthenticationService>().Object);
            builder.RegisterType <OrchardServices>().As <IOrchardServices>();
            builder.RegisterType <DefaultShapeTableManager>().As <IShapeTableManager>();
            builder.RegisterType <DefaultShapeFactory>().As <IShapeFactory>();
            builder.RegisterType <StubWorkContextAccessor>().As <IWorkContextAccessor>();
            builder.RegisterType <DefaultContentQuery>().As <IContentQuery>();

            builder.RegisterType <StubExtensionManager>().As <IExtensionManager>();
            builder.RegisterType <DefaultEncryptionService>().As <IEncryptionService>();
            builder.RegisterInstance(ShellSettingsUtility.CreateEncryptionEnabled());
            builder.RegisterType <ProcessingEngineStub>().As <IProcessingEngine>();
            builder.RegisterType <StubShellDescriptorManager>().As <IShellDescriptorManager>();
            builder.RegisterType <DefaultShapeFactory>().As <IShapeFactory>();

            builder.RegisterInstance(new Mock <IShapeTableLocator>().Object);
            builder.RegisterInstance(new Mock <IShapeDisplay>().Object);
            builder.RegisterInstance(new Mock <IMessageService>().Object);
            builder.RegisterType <StubClock>().As <IClock>();
            builder.RegisterInstance(new Mock <IPageClassBuilder>().Object);
            builder.RegisterType <DefaultContentDisplay>().As <IContentDisplay>();
            builder.RegisterGeneric(typeof(Repository <>)).As(typeof(IRepository <>));

            builder.RegisterType <MembershipService>().As <IMembershipService>();

            var _stubContextAccessor = new StubHttpContextAccessor();

            builder.RegisterInstance(_stubContextAccessor).As <IHttpContextAccessor>();
            builder.RegisterInstance(new Mock <IUserEventHandler>().Object);
            builder.RegisterInstance(new Mock <IAppConfigurationAccessor>().Object);
            builder.RegisterType <WeChatMsgHandler>().As <IWeChatMsgHandler>();
            builder.RegisterType <CardCouponService>().As <ICardCouponService>();
            builder.RegisterType <WxUserService>().As <IWxUserService>();

            builder.RegisterTypes(new System.Type[] {
                typeof(AuditNotPassWeChatMsgBehavior),
                typeof(AuditPassWeChatMsgBehavior),
                typeof(CardPayOrderWeChatMsgBehavior),
                typeof(CardSkuRemindWeChatMsgBehavior),
                typeof(DoNothingWeChatMsgBehavior),
                typeof(MerchantAuditWeChatMsgBehavior),
                typeof(SubmitMemberCardWeChatMsgBehavior),
                typeof(UpdateMemberCardWeChatMsgBehavior),
                typeof(UserConsumeCardWechatMsgBehavior),
                typeof(UserDelCardWeChatMsgBehavior),
                typeof(UserEnterSessionFromCardWeChatMsgBehavior),
                typeof(UserGetCardWeChatMsgBehavior),
                typeof(UserGiftingCardWeChatMsgBehavior),
                typeof(UserPayFromPayCellWeChatMsgBehavior),
                typeof(UserViewCardWeChatMsgBehavior)
            })
            .As <IWeChatEventBehavior>();
        }