コード例 #1
0
        public async Task CreateLoginAttempts_IpAddressDoesntExist_DataIsAccurate
            (int expectedId, string expectedIpAddress, int expectedLoginCounter, string expectedSuspensionEndTime)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository
                                                                   (new SQLServerGateway(), new ConnectionStringData());

            LoginAttemptsModel loginAttemptsModel = new LoginAttemptsModel();

            loginAttemptsModel.Id                = expectedId;
            loginAttemptsModel.IpAddress         = expectedIpAddress;
            loginAttemptsModel.LoginCounter      = expectedLoginCounter;
            loginAttemptsModel.SuspensionEndTime = DateTimeOffset.Parse(expectedSuspensionEndTime);

            // Act
            await loginAttemptsRepository.CreateLoginAttempts(loginAttemptsModel);

            var actualLoginAttempt = await loginAttemptsRepository.GetLoginAttemptsById(expectedId);

            // Assert
            Assert.IsTrue
            (
                actualLoginAttempt.Id == expectedId &&
                actualLoginAttempt.IpAddress == expectedIpAddress &&
                actualLoginAttempt.LoginCounter == expectedLoginCounter &&
                actualLoginAttempt.SuspensionEndTime == DateTimeOffset.Parse(expectedSuspensionEndTime)
            );
        }
コード例 #2
0
        public async Task CreateLoginAttempts_ExecutionTimeLessThan400Milliseconds
            (int loginAttemptId, string ipAddress, int loginCounter, string suspensionEndTime, long expectedMaxExecutionTime)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository
                                                                   (new SQLServerGateway(), new ConnectionStringData());

            LoginAttemptsModel loginAttemptsModel = new LoginAttemptsModel();

            loginAttemptsModel.Id                = loginAttemptId;
            loginAttemptsModel.IpAddress         = ipAddress;
            loginAttemptsModel.LoginCounter      = loginCounter;
            loginAttemptsModel.SuspensionEndTime = DateTimeOffset.Parse(suspensionEndTime);

            // Act
            var timer = Stopwatch.StartNew();
            await loginAttemptsRepository.CreateLoginAttempts(loginAttemptsModel);

            timer.Stop();

            var actualExecutionTime = timer.ElapsedMilliseconds;

            Debug.WriteLine("Actual Execution Time: " + actualExecutionTime);

            // Assert
            Assert.IsTrue(actualExecutionTime <= expectedMaxExecutionTime);
        }
コード例 #3
0
        public async Task GetAllLoginAttempts_AtLeastTwoLoginAttemptsExist_ReturnsCorrectNumberOfLoginAttempts
            (int numLoginAttempts)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository =
                new LoginAttemptsRepository(new SQLServerGateway(), new ConnectionStringData());

            // Act
            IEnumerable <LoginAttemptsModel> loginAttempts = await loginAttemptsRepository.GetAllLoginAttempts();

            // Assert
            int i = 1;

            foreach (LoginAttemptsModel loginAttempt in loginAttempts)
            {
                if (loginAttempt.Id == i)
                {
                    ++i;
                    continue;
                }
            }

            if (i == numLoginAttempts + 1)
            {
                Assert.IsTrue(true);
            }
            else
            {
                Assert.IsTrue(false);
            }
        }
コード例 #4
0
        public async Task IncrementLoginCounterByIpAddress_IpExists_ReturnTrue(string ipAddress)
        {
            // Arrange
            IDataGateway             dataGateway             = new SQLServerGateway();
            IConnectionStringData    connectionString        = new ConnectionStringData();
            ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository(dataGateway, connectionString);

            var oldLoginAttemptsModel = await loginAttemptsRepository.GetLoginAttemptsByIpAddress(ipAddress);

            var expectedResult = true;

            ILoginAttemptsService loginAttemptsService = new LoginAttemptsService(loginAttemptsRepository);

            // Act
            var actualResult = await loginAttemptsService.IncrementLoginCounterByIpAddress(ipAddress);

            var newLoginAttemptsModel = await loginAttemptsRepository.GetLoginAttemptsByIpAddress(ipAddress);

            // Assert
            Assert.IsTrue
            (
                actualResult == expectedResult &&
                newLoginAttemptsModel.LoginCounter == (oldLoginAttemptsModel.LoginCounter + 1)
            );
        }
コード例 #5
0
        public async Task GetLoginAttemptsByIpAddress_IpExists_ReturnBusinessLoginAttemptsModel(int id, string ipAddress,
                                                                                                int loginCounter, string suspensionEndtime)
        {
            // Arrange
            IDataGateway             dataGateway             = new SQLServerGateway();
            IConnectionStringData    connectionString        = new ConnectionStringData();
            ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository(dataGateway, connectionString);

            var expectedResult = new BusinessLoginAttemptsModel();

            expectedResult.Id                = id;
            expectedResult.IpAddress         = ipAddress;
            expectedResult.LoginCounter      = loginCounter;
            expectedResult.SuspensionEndTime = DateTimeOffset.Parse(suspensionEndtime);

            ILoginAttemptsService loginAttemptsService = new LoginAttemptsService(loginAttemptsRepository);

            // Act
            var actualResult = await loginAttemptsService.GetLoginAttemptsByIpAddress(ipAddress);

            // Assert
            Assert.IsTrue
            (
                actualResult.Id == expectedResult.Id &&
                actualResult.IpAddress == expectedResult.IpAddress &&
                actualResult.LoginCounter == expectedResult.LoginCounter &&
                actualResult.SuspensionEndTime == expectedResult.SuspensionEndTime
            );
        }
コード例 #6
0
        public async Task CleanUp()
        {
            IDataGateway             dataGateway             = new SQLServerGateway();
            IConnectionStringData    connectionString        = new ConnectionStringData();
            ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository(dataGateway, connectionString);
            var loginAttempts = await loginAttemptsRepository.GetAllLoginAttempts();

            foreach (var loginAttempt in loginAttempts)
            {
                await loginAttemptsRepository.DeleteLoginAttemptsById(loginAttempt.Id);
            }
            await DataAccessTestHelper.ReseedAsync("LoginAttempts", 0, connectionString, dataGateway);
        }
コード例 #7
0
        public async Task ResetLoginCounterByIpAddress_LoginCounterIsAccurate(string ipAddress)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository =
                new LoginAttemptsRepository(new SQLServerGateway(), new ConnectionStringData());

            // Act
            await loginAttemptsRepository.ResetLoginCounterByIpAddress(ipAddress);

            var newLoginAttempt = await loginAttemptsRepository.GetLoginAttemptsByIpAddress(ipAddress);

            // Assert
            Assert.IsTrue(newLoginAttempt.LoginCounter == 0);
        }
コード例 #8
0
        public async Task GetLoginAttemptsById_LoginAttemptExists_IpAddressCorrect(int expectedId, string expectedIpAddress)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository =
                new LoginAttemptsRepository(new SQLServerGateway(), new ConnectionStringData());

            // Act
            var loginAttemptModel = await loginAttemptsRepository.GetLoginAttemptsById(expectedId);

            var actualIpAddress = loginAttemptModel.IpAddress;

            // Assert
            Assert.IsTrue(actualIpAddress == expectedIpAddress);
        }
コード例 #9
0
        public async Task GetLoginAttemptsById_LoginAttemptExists_ReturnsLoginAttempts(int expectedId)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository =
                new LoginAttemptsRepository(new SQLServerGateway(), new ConnectionStringData());

            // Act
            var loginAttemptModel = await loginAttemptsRepository.GetLoginAttemptsById(expectedId);

            var actualId = loginAttemptModel.Id;

            // Assert
            Assert.IsTrue(actualId == expectedId);
        }
コード例 #10
0
        public async Task DeleteLoginAttemptsById_LoginAttemptsExists_LoginAttemptsIsNull(int id)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository =
                new LoginAttemptsRepository(new SQLServerGateway(), new ConnectionStringData());

            // Act
            await loginAttemptsRepository.DeleteLoginAttemptsById(id);

            var retrievedLoginAttempt = await loginAttemptsRepository.GetLoginAttemptsById(id);

            // Assert
            Assert.IsNull(retrievedLoginAttempt);
        }
コード例 #11
0
        public async Task GetLoginAttemptsByIpAddress_IpDoesNotExists_ReturnNull(string ipAddress)
        {
            // Arrange
            IDataGateway             dataGateway             = new SQLServerGateway();
            IConnectionStringData    connectionString        = new ConnectionStringData();
            ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository(dataGateway, connectionString);

            ILoginAttemptsService loginAttemptsService = new LoginAttemptsService(loginAttemptsRepository);

            // Act
            var actualResult = await loginAttemptsService.GetLoginAttemptsByIpAddress(ipAddress);

            // Assert
            Assert.IsNull(actualResult);
        }
コード例 #12
0
        public int RemainingBlocked(string username)
        {
            LoginAttemptsRepository loginAttempts = new LoginAttemptsRepository();
            string   userIp          = loginAttempts.GetIP();
            TimeSpan elapsedUsername = TimeSpan.Zero;
            TimeSpan elapsedIp       = TimeSpan.Zero;

            TimeSpan result = TimeSpan.Zero;

            if (loginAttempts.DoesUsernameAttemptExist(username) == true)
            {
                LoginAttempt l = loginAttempts.GetUsernameAttempt(username);
                elapsedUsername = DateTime.Now.Subtract((DateTime)l.Time);
            }
            if (loginAttempts.DoesIpAttemptExist(userIp) == true)
            {
                IpAttempt i = loginAttempts.GetIpAttempt(userIp);
                elapsedIp = DateTime.Now.Subtract((DateTime)i.Time);
            }

            if ((elapsedUsername > TimeSpan.Zero) && (elapsedIp == TimeSpan.Zero))
            {
                result = elapsedUsername;
            }
            else if ((elapsedIp > TimeSpan.Zero) && (elapsedUsername == TimeSpan.Zero))
            {
                result = elapsedIp;
            }
            else
            {
                int compare = TimeSpan.Compare(elapsedUsername, elapsedIp);
                switch (compare)
                {
                case -1:
                    result = elapsedUsername;
                    break;

                case 0:
                    result = elapsedUsername;
                    break;

                case 1:
                    result = elapsedUsername;
                    break;
                }
            }
            return(15 - (int)result.TotalMinutes);
        }
コード例 #13
0
        public async Task IncrementLoginCounterById_LoginCounterIsAccurate(int id)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository =
                new LoginAttemptsRepository(new SQLServerGateway(), new ConnectionStringData());

            // Act
            var oldLoginAttempt = await loginAttemptsRepository.GetLoginAttemptsById(id);

            await loginAttemptsRepository.IncrementLoginCounterById(id);

            var newLoginAttempt = await loginAttemptsRepository.GetLoginAttemptsById(id);

            // Assert
            Assert.IsTrue(newLoginAttempt.LoginCounter == (oldLoginAttempt.LoginCounter + 1));
        }
コード例 #14
0
        public async Task SetSuspensionEndTimeByIpAddress_IpExists_ReturnTrue(string ipAddress, int suspensionHours)
        {
            // Arrange
            IDataGateway             dataGateway             = new SQLServerGateway();
            IConnectionStringData    connectionString        = new ConnectionStringData();
            ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository(dataGateway, connectionString);

            var expectedResult = true;

            ILoginAttemptsService loginAttemptsService = new LoginAttemptsService(loginAttemptsRepository);

            // Act
            var actualResult = await loginAttemptsService.SetSuspensionEndTimeByIpAddress(ipAddress, suspensionHours);

            // Assert
            Assert.IsTrue(actualResult == expectedResult);
        }
コード例 #15
0
        public async Task AddIpAddress_IpDoesntExist_ReturnTrue(string ipAddress, int loginCounter)
        {
            // Arrange
            IDataGateway             dataGateway             = new SQLServerGateway();
            IConnectionStringData    connectionString        = new ConnectionStringData();
            ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository(dataGateway, connectionString);

            var expectedResult = true;

            ILoginAttemptsService loginAttemptsService = new LoginAttemptsService(loginAttemptsRepository);

            // Act
            var actualResult = await loginAttemptsService.AddIpAddress(ipAddress, loginCounter);

            // Assert
            Assert.IsTrue(actualResult == expectedResult);
        }
コード例 #16
0
        public async Task UpdateSuspensionEndTimeById_SuspensionEndtimeIsAccurate(int id, string expectedSuspensionEndTime)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository =
                new LoginAttemptsRepository(new SQLServerGateway(), new ConnectionStringData());

            // Act
            await loginAttemptsRepository.UpdateSuspensionEndTimeById(id,
                                                                      DateTimeOffset.Parse(expectedSuspensionEndTime));

            var newLoginAttempt = await loginAttemptsRepository.GetLoginAttemptsById(id);

            var actualSuspensionEndTime = newLoginAttempt.SuspensionEndTime;

            // Assert
            Assert.IsTrue(actualSuspensionEndTime == DateTimeOffset.Parse(expectedSuspensionEndTime));
        }
コード例 #17
0
        public async Task UpdateSuspensionEndtimeById_ExecutionTimeLessThan400Milliseconds
            (int id, string suspensionEndTime, long expectedMaxExecutionTime)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository
                                                                   (new SQLServerGateway(), new ConnectionStringData());

            // Act
            var timer = Stopwatch.StartNew();
            await loginAttemptsRepository.UpdateSuspensionEndTimeById(id, DateTimeOffset.Parse(suspensionEndTime));

            timer.Stop();

            var actualExecutionTime = timer.ElapsedMilliseconds;

            Debug.WriteLine("Actual Execution Time: " + actualExecutionTime);

            // Assert
            Assert.IsTrue(actualExecutionTime <= expectedMaxExecutionTime);
        }
コード例 #18
0
        public async Task GetAllLoginAttempts_AtLeastTwoLoginAttemptsExist_ExecutionTimeLessThan400Milliseconds
            (long expectedMaxExecutionTime)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository
                                                                   (new SQLServerGateway(), new ConnectionStringData());

            // Act
            var timer = Stopwatch.StartNew();
            await loginAttemptsRepository.GetAllLoginAttempts();

            timer.Stop();

            var actualExecutionTime = timer.ElapsedMilliseconds;

            Debug.WriteLine("Actual Execution Time: " + actualExecutionTime);

            // Assert
            Assert.IsTrue(actualExecutionTime <= expectedMaxExecutionTime);
        }
コード例 #19
0
        public async Task ResetLoginCounterById_ExecutionTimeLessThan400Milliseconds
            (int id, long expectedMaxExecutionTime)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository
                                                                   (new SQLServerGateway(), new ConnectionStringData());

            // Act
            var timer = Stopwatch.StartNew();
            await loginAttemptsRepository.ResetLoginCounterById(id);

            timer.Stop();

            var actualExecutionTime = timer.ElapsedMilliseconds;

            Debug.WriteLine("Actual Execution Time: " + actualExecutionTime);

            // Assert
            Assert.IsTrue(actualExecutionTime <= expectedMaxExecutionTime);
        }
コード例 #20
0
        public async Task Init()
        {
            await TestCleaner.CleanDatabase();

            var numTestRows = 10;

            IDataGateway             dataGateway             = new SQLServerGateway();
            IConnectionStringData    connectionString        = new ConnectionStringData();
            ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository(dataGateway, connectionString);

            for (int i = 1; i <= numTestRows; ++i)
            {
                LoginAttemptsModel loginAttemptsModel = new LoginAttemptsModel();
                loginAttemptsModel.Id                = i;
                loginAttemptsModel.IpAddress         = "127.0.0." + i;
                loginAttemptsModel.LoginCounter      = i;
                loginAttemptsModel.SuspensionEndTime = DateTimeOffset.Parse("3/28/2007 7:13:50 PM +00:00");

                await loginAttemptsRepository.CreateLoginAttempts(loginAttemptsModel);
            }
        }
コード例 #21
0
        public bool IsBlocked(string username)
        {
            LoginAttemptsRepository loginAttempts = new LoginAttemptsRepository();
            string userIp = loginAttempts.GetIP();

            bool usernameBlocked = false;
            bool ipBlocked       = false;

            if (loginAttempts.DoesUsernameAttemptExist(username) == true)
            {
                LoginAttempt l = loginAttempts.GetUsernameAttempt(username);
                if ((bool)l.Blocked)
                {
                    TimeSpan elapsed = DateTime.Now.Subtract((DateTime)l.Time);
                    usernameBlocked = (elapsed.Minutes >= 15) ? false : true;
                    if (usernameBlocked == false)
                    {
                        loginAttempts.DeleteUsernameAttempt(l);
                    }
                }
            }
            if (loginAttempts.DoesIpAttemptExist(userIp) == true)
            {
                IpAttempt i = loginAttempts.GetIpAttempt(userIp);
                if ((bool)i.Blocked)
                {
                    TimeSpan elapsed = DateTime.Now.Subtract((DateTime)i.Time);
                    ipBlocked = (elapsed.Minutes >= 15) ? false : true;
                    if (ipBlocked == false)
                    {
                        loginAttempts.DeleteIpAttempt(i);
                    }
                }
            }
            return(usernameBlocked || ipBlocked);
        }
コード例 #22
0
        public bool Login(string username, string password)
        {
            //return new UsersRepository().Login(username, new Encryption().HashString(password));

            LoginAttemptsRepository loginAttempts = new LoginAttemptsRepository();

            bool validLogin = new UsersRepository().Login(username, new Encryption().HashString(password));

            if (validLogin == true)
            {
                return(validLogin);
            }
            else
            {
                string userIp = loginAttempts.GetIP();

                if (loginAttempts.DoesUsernameAttemptExist(username) == false)
                {
                    LoginAttempt l = new LoginAttempt
                    {
                        Username = username,
                        Attempt  = 1,
                        Time     = DateTime.Now,
                        Blocked  = false,
                    };
                    loginAttempts.AddUsernameAttempt(l);
                }
                else
                {
                    LoginAttempt oldusername;

                    if (loginAttempts.DoesUsernameAttemptExist(username) == true)
                    {
                        oldusername = loginAttempts.GetUsernameAttempt(username);
                        bool usernameBlockCheck = (oldusername.Attempt >= 2) ? true : false;

                        LoginAttempt updateUsername = new LoginAttempt
                        {
                            Username = username,
                            Attempt  = oldusername.Attempt++,
                            Time     = oldusername.Time,
                            Blocked  = usernameBlockCheck,
                        };
                        loginAttempts.UpdateUsernameAttempt(oldusername, updateUsername);
                    }
                }

                if (loginAttempts.DoesIpAttemptExist(userIp) == false)
                {
                    IpAttempt i = new IpAttempt
                    {
                        Attempt    = 1,
                        Time       = DateTime.Now,
                        Blocked    = false,
                        Ip_Address = userIp
                    };
                    loginAttempts.AddIpAttempt(i);
                }
                else
                {
                    IpAttempt oldIp;

                    if (loginAttempts.DoesIpAttemptExist(userIp) == true)
                    {
                        oldIp = loginAttempts.GetIpAttempt(userIp);
                        bool ipBlockCheck = (oldIp.Attempt >= 2) ? true : false;

                        IpAttempt updateIp = new IpAttempt
                        {
                            Ip_Address = userIp,
                            Attempt    = oldIp.Attempt++,
                            Time       = oldIp.Time,
                            Blocked    = ipBlockCheck,
                        };
                        loginAttempts.UpdateIpAttempt(oldIp, updateIp);
                    }
                }
                return(validLogin);
            }
        }
コード例 #23
0
        public void DoLogLoginUser(LoginAttempts log)
        {
            LoginAttemptsRepository lRepo = new LoginAttemptsRepository();

            lRepo.Insert(log);
        }
コード例 #24
0
        public static async Task CleanDatabase()
        {
            IDataGateway                        dataGateway                        = new SQLServerGateway();
            IConnectionStringData               connectionString                   = new ConnectionStringData();
            IUserAccountRepository              userAccountRepository              = new UserAccountRepository(dataGateway, connectionString);
            IUserProfileRepository              userProfileRepository              = new UserProfileRepository(dataGateway, connectionString);
            IUserAccountCodeRepository          userAccountCodeRepository          = new UserAccountCodeRepository(dataGateway, connectionString);
            IUserAccountSettingsRepository      userAccountSettingsRepository      = new UserAccountSettingRepository(dataGateway, connectionString);
            ILoginAttemptsRepository            loginAttemptsRepository            = new LoginAttemptsRepository(dataGateway, connectionString);
            IResourceRepository                 resourceRepository                 = new ResourceRepository(dataGateway, connectionString);
            IClaimRepository                    claimRepository                    = new ClaimRepository(dataGateway, connectionString);
            IScopeRepository                    scopeRepository                    = new ScopeRepository(dataGateway, connectionString);
            IScopeClaimRepository               scopeClaimRepository               = new ScopeClaimRepository(dataGateway, connectionString);
            IUserScopeRepository                userScopeRepository                = new UserScopeRepository(dataGateway, connectionString);
            IUserClaimRepository                userClaimRepository                = new UserClaimRepository(dataGateway, connectionString);
            IAssignmentPolicyRepository         assignmentPolicyRepository         = new AssignmentPolicyRepository(dataGateway, connectionString);
            IAssignmentPolicyPairingRepository  assignmentPolicyPairingRepository  = new AssignmentPolicyPairingRepository(dataGateway, connectionString);
            IUserScopeClaimRepository           userScopeClaimRepository           = new UserScopeClaimRepository(dataGateway, connectionString);
            IAccessPolicyRepository             accessPolicyRepository             = new AccessPolicyRepository(dataGateway, connectionString);
            IAccessPolicyPairingRepository      accessPolicyPairingRepository      = new AccessPolicyPairingRepository(dataGateway, connectionString);
            ITraditionalListingSearchRepository traditionalListingSearchRepository = new TraditionalListingSearchRepository(dataGateway, connectionString);


            var accounts = await userAccountRepository.GetAllAccounts();

            var profiles = await userProfileRepository.GetAllUserProfiles();

            var accountCodes = await userAccountCodeRepository.GetAllUserAccountCodes();

            var accountSettings = await userAccountSettingsRepository.GetAllSettings();

            var loginAttempts = await loginAttemptsRepository.GetAllLoginAttempts();

            var resources = await resourceRepository.GetAllResources();

            var claims = await claimRepository.GetAllClaims();

            var scopes = await scopeRepository.GetAllScopes();

            var scopeClaims = await scopeClaimRepository.GetAllScopeClaims();

            var userClaims = await userClaimRepository.GetAllUserClaims();

            var userScopes = await userScopeRepository.GetAllUserScopes();

            var assignmentPolicies = await assignmentPolicyRepository.GetAllAssignmentPolicies();

            var assignmentPolicyPairings = await assignmentPolicyPairingRepository.GetAllAssignmentPolicyPairings();

            var userScopeClaims = await userScopeClaimRepository.GetAllUserScopeClaims();

            var accessPolicies = await accessPolicyRepository.GetAllAccessPolicies();

            var accesssPolicyPairings = await accessPolicyPairingRepository.GetAllAccessPoliciesPairings();

            var listings = await traditionalListingSearchRepository.GetAllListings();

            var collaborationListings = await traditionalListingSearchRepository.GetAllCollaborationListings();

            var relationshipListings = await traditionalListingSearchRepository.GetAllRelationshipListings();

            var teamListings = await traditionalListingSearchRepository.GetAllTeamListings();

            if (resources != null)
            {
                await DeleteAllFromTable("Resource");
                await ReseedAsync("Resource", 0, connectionString, dataGateway);
            }

            if (claimRepository != null)
            {
                await DeleteAllFromTable("Claim");
                await ReseedAsync("Claim", 0, connectionString, dataGateway);
            }

            if (scopeRepository != null)
            {
                await DeleteAllFromTable("Scope");
                await ReseedAsync("Scope", 0, connectionString, dataGateway);
            }

            if (scopeClaims != null)
            {
                await DeleteAllFromTable("ScopeClaim");
                await ReseedAsync("ScopeClaim", 0, connectionString, dataGateway);
            }
            if (assignmentPolicies != null)
            {
                await DeleteAllFromTable("AssignmentPolicy");
                await ReseedAsync("AssignmentPolicy", 0, connectionString, dataGateway);
            }

            if (assignmentPolicyPairings != null)
            {
                await DeleteAllFromTable("AssignmentPolicyPairing");
            }

            if (userScopeClaims != null)
            {
                await DeleteAllFromTable("UserScopeClaim");
                await ReseedAsync("UserScopeClaim", 0, connectionString, dataGateway);
            }

            if (userScopes != null)
            {
                await DeleteAllFromTable("UserScope");
                await ReseedAsync("UserScope", 0, connectionString, dataGateway);
            }

            if (userClaims != null)
            {
                await DeleteAllFromTable("UserClaim");
                await ReseedAsync("UserClaim", 0, connectionString, dataGateway);
            }

            if (accessPolicies != null)
            {
                await DeleteAllFromTable("AccessPolicy");
                await ReseedAsync("AccessPolicy", 0, connectionString, dataGateway);
            }

            if (accesssPolicyPairings != null)
            {
                await DeleteAllFromTable("AccessPolicyPairing");
                await ReseedAsync("AssignmentPolicyPairing", 0, connectionString, dataGateway);
                await ReseedAsync("AccessPolicyPairing", 0, connectionString, dataGateway);
            }

            if (loginAttempts != null)
            {
                await DeleteAllFromTable("LoginAttempts");
                await ReseedAsync("LoginAttempts", 0, connectionString, dataGateway);
            }

            if (accounts != null)
            {
                await DeleteAllFromTable("UserProfile");
                await DeleteAllFromTable("UserAccountSettings");
                await DeleteAllFromTable("UserAccountCode");
                await DeleteAllFromTable("UserAccount");

                await ReseedAsync("UserAccount", 0, connectionString, dataGateway);
                await ReseedAsync("UserProfile", 0, connectionString, dataGateway);
                await ReseedAsync("UserAccountCode", 0, connectionString, dataGateway);
                await ReseedAsync("UserAccountSettings", 0, connectionString, dataGateway);
            }
            if (listings != null)
            {
                await DeleteAllFromTable("Listing");
                await ReseedAsync("Listing", 0, connectionString, dataGateway);
            }
            if (collaborationListings != null)
            {
                await DeleteAllFromTable("Collaboration");
                await ReseedAsync("Collaboration", 0, connectionString, dataGateway);
            }
            if (relationshipListings != null)
            {
                await DeleteAllFromTable("Relationship");
                await ReseedAsync("Relationship", 0, connectionString, dataGateway);
            }
            if (teamListings != null)
            {
                await DeleteAllFromTable("TeamModel");
                await ReseedAsync("TeamModel", 0, connectionString, dataGateway);
            }
        }