示例#1
0
 public MembershipService(
     IDbContext dbContext,
     ASUserManager userManager,
     ASRoleManager roleManager,
     ASSignInManager signInManager,
     ITemplateService templateService,
     IMailService mailService,
     IDbContextFactory dbContextFactory,
     IContextProvider contextProvider,
     IDataProtectionProvider dataProtectionProvider,
     ISettingManager settingManager,
     IResourceManager resourceManager,
     IXmlSerializer xmlSerializer,
     IAppManager appManager)
 {
     this._resourceManager  = resourceManager;
     this._dbContext        = dbContext;
     this._roleManager      = roleManager;
     this._userManager      = userManager;
     this._signInManager    = signInManager;
     this._templateService  = templateService;
     this._settingManager   = settingManager;
     this._mailService      = mailService;
     this._dbContextFactory = dbContextFactory;
     this._contextProvider  = contextProvider;
     this._appManager       = appManager;
     this._xmlSerializer    = xmlSerializer;
     this._userManager.UserTokenProvider = new DataProtectorTokenProvider <ASUser, int>(
         dataProtectionProvider.Create("EmailConfirmation"));
 }
示例#2
0
        public TestFixture()
        {
            var mockAppSettings        = new Mock <ISettingContainer <AppSetting> >();
            var mockContextProvider    = new Mock <IContextProvider>();
            var mockAppManager         = new Mock <IAppManager>();
            var mockMembershipSettings = new MembershipSettingContainer();
            var mockSettingManager     = new Mock <ISettingManager>();

            mockContextProvider.Setup(m => m.BrowserType).Returns("Chrome");
            mockContextProvider.Setup(m => m.ClientIP).Returns("111.222.333.444");
            mockContextProvider.Setup(m => m.CountryInfo).Returns(new Country("tr-TR", "Turkey"));
            mockContextProvider.Setup(m => m.Culture).Returns(CultureInfo.DefaultThreadCurrentCulture);
            mockContextProvider.Setup(m => m.HttpMethod).Returns("GET");
            mockContextProvider.Setup(m => m.RootAddress).Returns(@"http://www.asadmindemo.com");
            mockContextProvider.Setup(m => m.SessionId).Returns("q1w2e3r4");
            mockContextProvider.Setup(m => m.Url).Returns(new Uri("http://www.asadmindemo.com/Home"));
            mockContextProvider.Setup(m => m.UserId).Returns(1);
            mockContextProvider.Setup(m => m.UserName).Returns("UnitTester");
            mockAppSettings.Setup(m => m["DbQueryLogEnable"]).Returns(new AppSetting()
            {
                Value = "True"
            });
            mockAppManager.Setup(m => m.MapPhysicalFile(It.IsAny <string>())).Returns("Script.sql");

            _appSettings     = mockAppSettings.Object;
            _xmlSerializer   = new ASXmlSerializer();
            _contextProvider = mockContextProvider.Object;
            this._dbConnectionConfigurationFactory = delegate()
            {
                return(new DbConnectionConfiguration(ProviderName, ConnectionString));
            };
            _database   = new Infrastructure.Data.Database(_dbConnectionConfigurationFactory);
            _appManager = mockAppManager.Object;
            _typeFinder = new TypeFinder();
            mockSettingManager.Setup(m => m.GetContainer <AppSetting>()).Returns(_appSettings);
            mockSettingManager.Setup(m => m.GetContainer <MembershipSetting>()).Returns(mockMembershipSettings);

            _dbInitializer        = new ASDatabaseInitializer <ASDbContext>(_dbConnectionConfigurationFactory, _appManager);
            _dbCommandInterceptor = new ASDbCommandInterceptor(_database, _contextProvider, mockSettingManager.Object);
            _dbContextFactory     = new ASDbContextFactory(_xmlSerializer, _contextProvider, _dbInitializer,
                                                           _typeFinder, _dbConnectionConfigurationFactory);
            _dbContext = new ASDbContext(_xmlSerializer, _contextProvider, _dbInitializer,
                                         _typeFinder, _dbConnectionConfigurationFactory);
            _userStore   = new ASUserStore(_dbContext);
            _userManager = new ASUserManager(_userStore, mockSettingManager.Object);
        }
示例#3
0
 public ASSignInManager(ASUserManager userManager, IAuthenticationManager authenticationManager)
     : base(userManager, authenticationManager)
 {
 }