예제 #1
0
        public void Setup()
        {
            _transactionScope          = new TransactionScope();
            _sessionRepository         = new SessionRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _domicileRepository        = new DomicileRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _applicationUserRepository = new ApplicationUserRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _identityRoleRepository    = new IdentityRoleRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);

            _onshoreDom = BuildMeA.Domicile("onShore", "Onshore");

            _onshoreGovUser  = BuildMeA.ApplicationUser("onshoreGov");
            _onshoreReadOnly = BuildMeA.ApplicationUser("onshoreReadOnly");
            _onshoreDstAdmin = BuildMeA.ApplicationUser("onshoreDstAdmin");
            _onshoreAdmin    = BuildMeA.ApplicationUser("onshore-Admin");

            _offshoreDom     = BuildMeA.Domicile("offShore", "Offhore");
            _offShoreGovUser = BuildMeA.ApplicationUser("offshoreGov");;

            _session = BuildMeA.Session(Guid.NewGuid().ToString(), DateTime.Now.AddMinutes(10), DateTime.Now);

            _newSession  = BuildMeA.Session("newSession", DateTime.Now.Date.AddDays(-30), DateTime.Now.Date.AddDays(-30).AddHours(1));
            _newSession1 = BuildMeA.Session("newSession1", DateTime.Now.Date.AddDays(-30), DateTime.Now.Date.AddDays(-30).AddHours(1));
            _newSession2 = BuildMeA.Session("newSession1", DateTime.Now.Date.AddDays(-30), DateTime.Now.Date.AddDays(-30).AddHours(1));
            _newSession3 = BuildMeA.Session("newSession3", DateTime.Now.Date.AddDays(-30), DateTime.Now.Date.AddDays(-30).AddHours(1));
            _oldSession  = BuildMeA.Session("oldSession", DateTime.Now.Date.AddDays(-31), DateTime.Now.Date.AddDays(-31).AddHours(1));

            BuildUsers();
        }
예제 #2
0
 public void Setup()
 {
     this.transactionScope          = new TransactionScope();
     this.applicationUserRepository = new ApplicationUserRepository(ConfigurationManager.ConnectionStrings["BBOS"].ConnectionString);
     this.applicationUser           = BuildMeA.ApplicationUser("tron");
     this.applicationUser2          = BuildMeA.ApplicationUser("tron2");
     this.applicationUser3          = BuildMeA.ApplicationUser("flynn");
     this.applicationUser4          = BuildMeA.ApplicationUser("flynn2");
 }
예제 #3
0
        public void Setup()
        {
            _transactionScope          = new TransactionScope();
            _applicationUserRepository = new ApplicationUserRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _manCoRepository           = new ManCoRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _domicileRepository        = new DomicileRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _roleAdmin        = BuildMeA.IdentityRole("TestAdmin");
            _roleStandard     = BuildMeA.IdentityRole("TestStandard");
            _domicile1        = BuildMeA.Domicile("code", "description");
            _domicile2        = BuildMeA.Domicile("code2", "description2");
            _domicile3        = BuildMeA.Domicile("code3", "description3");
            _domicile4        = BuildMeA.Domicile("code4", "description4");
            _applicationUser  = BuildMeA.ApplicationUser("tron");
            _applicationUser2 = BuildMeA.ApplicationUser("tron2");
            _applicationUser3 = BuildMeA.ApplicationUser("flynn");
            _applicationUser4 = BuildMeA.ApplicationUser("flynn2");
            _applicationUser.Roles.Add(new IdentityUserRole()
            {
                Role   = _roleAdmin,
                RoleId = _roleAdmin.Id,
                User   = _applicationUser,
                UserId = _applicationUser.Id
            });
            _applicationUser2.Roles.Add(new IdentityUserRole()
            {
                Role   = _roleStandard,
                RoleId = _roleStandard.Id,
                User   = _applicationUser2,
                UserId = _applicationUser2.Id
            });

            _applicationUser3.Roles.Add(new IdentityUserRole()
            {
                Role   = _roleStandard,
                RoleId = _roleStandard.Id,
                User   = _applicationUser3,
                UserId = _applicationUser3.Id
            });

            _applicationUser4.Roles.Add(new IdentityUserRole()
            {
                Role   = _roleAdmin,
                RoleId = _roleAdmin.Id,
                User   = _applicationUser4,
                UserId = _applicationUser4.Id
            });

            _manCo1       = BuildMeA.ManCo("description1", "code1").WithDomicile(_domicile1);;
            _manCo2       = BuildMeA.ManCo("description2", "code2").WithDomicile(_domicile1);;
            _manCo3       = BuildMeA.ManCo("description3", "code3").WithDomicile(_domicile1);;
            _manCo4       = BuildMeA.ManCo("description4", "code4").WithDomicile(_domicile1);;
            _manCoList    = new List <ManCo>();
            _domicileList = new List <Domicile>();
        }
예제 #4
0
 public void SetUp()
 {
     this.transactionScope           = new TransactionScope();
     this.authoriseHistoryRepository = new AuthoriseHistoryRepository(ConfigurationManager.ConnectionStrings["BBOS"].ConnectionString);
     this.jobRepository     = new JobRepository(ConfigurationManager.ConnectionStrings["BBOS"].ConnectionString);
     this.job               = BuildMeA.Job(DateTime.Now, DateTime.Now, DateTime.Now, "jwelkjwejwe", "grid");
     this.managementCompany = BuildMeA.ManagementCompany("manconame", "mancocode", "mancoshortname", "rufudbid");
     this.manCoDoc          = BuildMeA.ManCoDoc(2, 3, "Pub file name", "version", 2);
     this.parentCompany     = BuildMeA.ParentCompany("parent company name");
     this.managementCompany.ParentCompany = this.parentCompany;
     this.user     = BuildMeA.ApplicationUser("user");
     this.job.User = this.user;
 }
예제 #5
0
        public void GivenAUserId_WhenITryToUpdateTheLastLoginDate_TheFailedLogInCountIsSetToZero()
        {
            ApplicationUser user = BuildMeA.ApplicationUser("usertron");

            this.applicationUserRepository.Create(user);

            this.applicationUserRepository.UpdateUserlastLogindate(user.Id);

            var result = this.applicationUserRepository.GetUserByName(user.UserName);

            result.Should().NotBeNull();
            result.FailedLogInCount.Should().Be(0);
        }
예제 #6
0
        public void GivenAUserId_WhenITryToUpdateTheLastLoginDate_TheLastLogindateIsUpdated()
        {
            ApplicationUser user;

            user             = BuildMeA.ApplicationUser("usertron");
            user.IsLockedOut = true;

            this._applicationUserRepository.Create(user);
            this._applicationUserRepository.UnlockUser(user.Id);
            var result = this._applicationUserRepository.GetUserByName(user.UserName);

            result.IsLockedOut.Should().BeFalse();
        }
예제 #7
0
 public void Setup()
 {
     _transactionScope          = new TransactionScope();
     _manCoRepository           = new ManCoRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
     _domicileRepository        = new DomicileRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
     _applicationUserRepository = new ApplicationUserRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
     _domicile  = BuildMeA.Domicile("code", "description");
     _domicile2 = BuildMeA.Domicile("code2", "description2");
     _manCo1    = BuildMeA.ManCo("description", "code").WithDomicile(_domicile);
     _manCo2    = BuildMeA.ManCo("description2", "code2").WithDomicile(_domicile);
     _manCo3    = BuildMeA.ManCo("description3", "code3").WithDomicile(_domicile);
     _manCo4    = BuildMeA.ManCo("description4", "code4").WithDomicile(_domicile2);
     _user      = BuildMeA.ApplicationUser("warrior");
 }
예제 #8
0
        public void GivenAUserId_WhenITryToUpdateTheFailedLoginCount_TheFailedLogInCountIsIncremented()
        {
            ApplicationUser user = BuildMeA.ApplicationUser("usertron");

            this.applicationUserRepository.Create(user);

            Int32 initialCount = user.FailedLogInCount;

            this.applicationUserRepository.UpdateUserFailedLogin(user.Id);

            var result = this.applicationUserRepository.GetUserByName(user.UserName);

            result.FailedLogInCount.Should().Be(initialCount + 1);
        }
예제 #9
0
 public void Setup()
 {
     _transactionScope          = new TransactionScope();
     _passwordHistoryRepository = new PasswordHistoryRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
     _applicationUserRepository = new ApplicationUserRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
     _user             = BuildMeA.ApplicationUser("user1");
     _passwordHistory1 = BuildMeA.PasswordHistory(_user.Id, "password1");
     _passwordHistory2 = BuildMeA.PasswordHistory(_user.Id, "password2");
     _passwordHistory3 = BuildMeA.PasswordHistory(_user.Id, "password3");
     _passwordHistory4 = BuildMeA.PasswordHistory(_user.Id, "password4");
     _passwordHistory5 = BuildMeA.PasswordHistory(_user.Id, "password5");
     _passwordHistory6 = BuildMeA.PasswordHistory(_user.Id, "password6");
     _passwordHistory7 = BuildMeA.PasswordHistory(_user.Id, "password7");
     _passwordHistory8 = BuildMeA.PasswordHistory(_user.Id, "password8");
 }
예제 #10
0
        public void GivenAUserId_WhenITryToUnlockAUser_TheUserIsUnlocked()
        {
            ApplicationUser user = BuildMeA.ApplicationUser("usertron");

            user.LastLoginDate = new DateTime(2013, 12, 10);

            this.applicationUserRepository.Create(user);

            this.applicationUserRepository.UpdateUserlastLogindate(user.Id);

            var result = this.applicationUserRepository.GetUserByName(user.UserName);

            result.Should().NotBeNull();
            result.LastLoginDate.Value.ToShortDateString().ShouldBeEquivalentTo(DateTime.Now.ToShortDateString());
        }
 public void Setup()
 {
     _transactionScope           = new TransactionScope();
     _applicationUserRepository  = new ApplicationUserRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
     _securityAnswerRepository   = new SecurityAnswerRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
     _securityQuestionRepository = new SecurityQuestionRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
     _user = BuildMeA.ApplicationUser("user1");
     _securityQuestion1 = BuildMeA.SecurityQuestion("question 1");
     _securityQuestion2 = BuildMeA.SecurityQuestion("question 2");
     _securityQuestion3 = BuildMeA.SecurityQuestion("question 3");
     _securityQuestion4 = BuildMeA.SecurityQuestion("question 4");
     _securityAnswer1   = BuildMeA.SecurityAnswer("answer 1").WithSecurityQuestionId(_securityQuestion1.Id).WithUserId(_user.Id);
     _securityAnswer2   = BuildMeA.SecurityAnswer("answer 2").WithSecurityQuestionId(_securityQuestion2.Id).WithUserId(_user.Id);
     _securityAnswer3   = BuildMeA.SecurityAnswer("answer 3").WithSecurityQuestionId(_securityQuestion3.Id).WithUserId(_user.Id);
     _securityAnswer4   = BuildMeA.SecurityAnswer("answer 4").WithSecurityQuestionId(_securityQuestion4.Id).WithUserId(_user.Id);
 }
예제 #12
0
        public void GivenAUserId_WhenITryToUpdateTheLastPasswordChangedDate_TheLastPasswordChangedDateIsUpdated()
        {
            ApplicationUser user;

            user = BuildMeA.ApplicationUser("usertron");

            user.LastPasswordChangedDate = new DateTime(2013, 12, 10);

            this.applicationUserRepository.Create(user);

            this.applicationUserRepository.UpdateUserLastPasswordChangedDate(user.Id);

            var result = this.applicationUserRepository.GetUserByName(user.UserName);

            result.Should().NotBeNull();
            result.LastPasswordChangedDate.ToShortDateString().ShouldBeEquivalentTo(DateTime.Now.ToShortDateString());
        }
예제 #13
0
 public void Setup()
 {
     this.transactionScope          = new TransactionScope();
     this.passwordHistoryRepository = new PasswordHistoryRepository(ConfigurationManager.ConnectionStrings["BBOS"].ConnectionString);
     this.applicationUserRepository = new ApplicationUserRepository(ConfigurationManager.ConnectionStrings["BBOS"].ConnectionString);
     this.user              = BuildMeA.ApplicationUser("user1");
     this.passwordHistory1  = BuildMeA.PasswordHistory(this.user.Id, "password1");
     this.passwordHistory2  = BuildMeA.PasswordHistory(this.user.Id, "password2");
     this.passwordHistory3  = BuildMeA.PasswordHistory(this.user.Id, "password3");
     this.passwordHistory4  = BuildMeA.PasswordHistory(this.user.Id, "password4");
     this.passwordHistory5  = BuildMeA.PasswordHistory(this.user.Id, "password5");
     this.passwordHistory6  = BuildMeA.PasswordHistory(this.user.Id, "password6");
     this.passwordHistory7  = BuildMeA.PasswordHistory(this.user.Id, "password7");
     this.passwordHistory8  = BuildMeA.PasswordHistory(this.user.Id, "password8");
     this.passwordHistory9  = BuildMeA.PasswordHistory(this.user.Id, "password9");
     this.passwordHistory10 = BuildMeA.PasswordHistory(this.user.Id, "password10");
     this.passwordHistory11 = BuildMeA.PasswordHistory(this.user.Id, "password11");
     this.passwordHistory12 = BuildMeA.PasswordHistory(this.user.Id, "password12");
     this.passwordHistory13 = BuildMeA.PasswordHistory(this.user.Id, "password13");
 }
예제 #14
0
        public void SetUp()
        {
            this.transactionScope          = new TransactionScope();
            this.applicationUserRepository = new ApplicationUserRepository(ConfigurationManager.ConnectionStrings["BBOS"].ConnectionString);
            this.jobStatusRepository       = new JobStatusRepository(ConfigurationManager.ConnectionStrings["BBOS"].ConnectionString);
            this.jobRepository             = new JobRepository(ConfigurationManager.ConnectionStrings["BBOS"].ConnectionString);
            this.jobStatusTypeRepository   = new JobStatusTypeRepository(ConfigurationManager.ConnectionStrings["BBOS"].ConnectionString);

            this.user = BuildMeA.ApplicationUser("UserName");
            this.applicationUserRepository.Create(user);
            this.job            = BuildMeA.Job(DateTime.Now, DateTime.Now, DateTime.Now, String.Empty, "dfsdfjdf");
            this.job.ManCoDocID = 10;
            this.job.UserID     = this.user.Id;
            this.jobRepository.Create(this.job);

            this.jobStatusType = BuildMeA.JobStatusType("descrip");
            this.jobStatusTypeRepository.Create(this.jobStatusType);

            this.jobStatus       = BuildMeA.JobStatus(DateTime.Now).WithJobStatusType(this.jobStatusType);
            this.jobStatus.JobID = this.job.JobID;
        }