public async Task Init() { await TestCleaner.CleanDatabase(); var numTestRows = 20; IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IScopeRepository scopeRepository = new ScopeRepository(dataGateway, connectionString); IResourceRepository resourceRepository = new ResourceRepository(dataGateway, connectionString); IClaimRepository claimRepository = new ClaimRepository(dataGateway, connectionString); IAccessPolicyRepository accessPolicyRepository = new AccessPolicyRepository(dataGateway, connectionString); IAccessPolicyPairingRepository accessPolicyPairingRepository = new AccessPolicyPairingRepository(dataGateway, connectionString); for (int i = 1; i <= numTestRows; ++i) { ResourceModel resourceModel = new ResourceModel(); resourceModel.Id = i; resourceModel.Name = "TestResource" + i; ScopeModel scopeModel = new ScopeModel(); scopeModel.Id = i; scopeModel.Type = "TestScope" + i; scopeModel.Description = "TestDescription" + i; ClaimModel claimModel = new ClaimModel(); claimModel.Id = i; claimModel.Type = "TestClaim" + i; claimModel.Value = "TestDescription" + i; claimModel.IsDefault = true; var resourceId = await resourceRepository.CreateResource(resourceModel); var claimId = await claimRepository.CreateClaim(claimModel); var scopeId = await scopeRepository.CreateScope(scopeModel); AccessPolicyModel accessPolicyModel = new AccessPolicyModel(); accessPolicyModel.Id = i; accessPolicyModel.Name = "TestAccessPolicy" + i; accessPolicyModel.ResourceId = resourceId; accessPolicyModel.Priority = i % 4; var accessPolicyId = await accessPolicyRepository.CreateAccessPolicy(accessPolicyModel); AccessPolicyPairingModel accessPolicyPairingModel = new AccessPolicyPairingModel(); accessPolicyPairingModel.Id = i; accessPolicyPairingModel.ScopeId = scopeId; accessPolicyPairingModel.ClaimId = claimId; accessPolicyPairingModel.AccessPolicyId = accessPolicyId; await accessPolicyPairingRepository.CreateAccessPolicyPairing(accessPolicyPairingModel); } }
public async Task Init() { await TestCleaner.CleanDatabase(); var numTestRows = 20; IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IScopeRepository scopeRepository = new ScopeRepository(dataGateway, connectionString); for (int i = 1; i <= numTestRows; ++i) { ScopeModel scopeModel = new ScopeModel(); scopeModel.Id = i; scopeModel.Type = "TestScope" + i; scopeModel.Description = "TestDescription" + i; scopeModel.IsDefault = true; await scopeRepository.CreateScope(scopeModel); } }
public async Task Init() { await TestCleaner.CleanDatabase(); var numTestRows = 20; IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IScopeRepository scopeRepository = new ScopeRepository(dataGateway, connectionString); IAssignmentPolicyRepository assignmentPolicyRepository = new AssignmentPolicyRepository(dataGateway, connectionString); IAssignmentPolicyPairingRepository assignmentPolicyPairingRepository = new AssignmentPolicyPairingRepository(dataGateway, connectionString); for (int i = 1; i <= numTestRows; ++i) { ScopeModel scopeModel = new ScopeModel(); scopeModel.Id = i; scopeModel.Type = "TestScope" + i; scopeModel.Description = "TestDescription" + i; var scopeId = await scopeRepository.CreateScope(scopeModel); scopeModel.IsDefault = true; AssignmentPolicyModel assignmentPolicyModel = new AssignmentPolicyModel(); assignmentPolicyModel.Id = i; assignmentPolicyModel.Name = "TestClaim" + i; assignmentPolicyModel.IsDefault = true; assignmentPolicyModel.RequiredAccountType = "TestAccountType" + i; assignmentPolicyModel.Priority = i % 4; var policyId = await assignmentPolicyRepository.CreateAssignmentPolicy(assignmentPolicyModel); AssignmentPolicyPairingModel assignmentPolicyPairingModel = new AssignmentPolicyPairingModel(); assignmentPolicyPairingModel.Id = i; assignmentPolicyPairingModel.PolicyId = policyId; assignmentPolicyPairingModel.ScopeId = scopeId; await assignmentPolicyPairingRepository.CreateAssignmentPolicyPairing(assignmentPolicyPairingModel); } }