Esempio n. 1
0
 public void Setup()
 {
     _context            = MockRepository.GenerateStub <ISEContext>();
     _context.User       = new TestDbSet <User>();
     _context.LookupItem = new TestDbSet <LookupItem>();
     _context.LookupItem.Add(new LookupItem()
     {
         LookupTypeId = CONSTS.LookupTypeId.BadPassword, Description = "Password1"
     });
     _context.LookupItem.Add(new LookupItem()
     {
         LookupTypeId = CONSTS.LookupTypeId.BadPassword, Description = "LetMeIn123"
     });
     _context.LookupItem.Add(new LookupItem()
     {
         LookupTypeId = CONSTS.LookupTypeId.SecurityQuestion, Id = 142
     });
     _configuration = MockRepository.GenerateStub <IAppConfiguration>();
     _encryption    = MockRepository.GenerateMock <IEncryption>();
     _userStore     = MockRepository.GenerateMock <IAppUserStore <User> >();
     _bannedWords   = new List <string>()
     {
         "First Name", "SurName", "My Town", "My PostCode"
     };
     _sut = new AppUserManager(_configuration, _context, _encryption, _userStore);
 }
Esempio n. 2
0
 public UserController(IAppSensor appSensor, ISEContext context, IUserIdentity userIdentity) : base(userIdentity, appSensor)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     _context = context;
 }
        public void Setup()
        {
            _context      = MockRepository.GenerateStub <ISEContext>();
            _context.User = new TestDbSet <User>();
            _context.Stub(a => a.SaveChangesAsync()).Return(Task.FromResult(0));
            _configuration = MockRepository.GenerateStub <IAppConfiguration>();
            testRoleName   = "test Role";
            _testUser      = GetUser();
            _context.User.Add(_testUser);

            _sut = new UserStore <User>(_context, _configuration);
        }
Esempio n. 4
0
        public UserStore(ISEContext context, IAppConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _configuration = configuration;
            _context       = context;
        }
Esempio n. 5
0
 protected void BaseSetup()
 {
     _appSensor          = MockRepository.GenerateMock <IAppSensor>();
     _context            = MockRepository.GenerateStub <ISEContext>();
     _context.LookupItem = new TestDbSet <LookupItem>();
     _context.User       = new TestDbSet <User>();
     _context.User.Add(GetUser());
     _context.Stub(a => a.SaveChangesAsync()).Return(Task.FromResult(0));
     _userIdentity = MockRepository.GenerateMock <IUserIdentity>();
     _httpSession  = MockRepository.GenerateMock <HttpSessionStateBase>();
     _httpContext  = MockRepository.GenerateMock <HttpContextBase>();
     _httpRequest  = MockRepository.GenerateMock <HttpRequestBase>();
     _httpContext.Stub(c => c.Request).Return(_httpRequest);
     _httpContext.Stub(c => c.Session).Return(_httpSession);
 }
        public AccountController(IAppSensor appSensor, IAppConfiguration configuration, IEncryption encryption, IFormsAuth formsAuth, ISEContext context, IUserManager userManager, IRecaptcha recaptcha, IServices services, IUserIdentity userIdentity) : base(userIdentity, appSensor)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (encryption == null)
            {
                throw new ArgumentNullException("encryption");
            }
            if (formsAuth == null)
            {
                throw new ArgumentNullException("formsAuth");
            }
            if (recaptcha == null)
            {
                throw new ArgumentNullException("recaptcha");
            }
            if (services == null)
            {
                throw new ArgumentNullException("services");
            }
            if (userManager == null)
            {
                throw new ArgumentNullException("userManager");
            }

            _configuration = configuration;
            _context       = context;
            _encryption    = encryption;
            _formsAuth     = formsAuth;
            _recaptcha     = recaptcha;
            _services      = services;
            _userManager   = userManager;
        }
Esempio n. 7
0
        public AppUserManager(IAppConfiguration configuration, ISEContext context, IEncryption encryption, IAppUserStore <User> userStore)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (encryption == null)
            {
                throw new ArgumentNullException("encryption");
            }
            if (userStore == null)
            {
                throw new ArgumentNullException("userStore");
            }

            _configuration = configuration;
            _context       = context;
            _encryption    = encryption;
            _userStore     = userStore;
        }