protected void InitialiseTestObjects() { _teams = new EFTeamRepository { CreateContext = () => _connection.GetContext() }; _users = new EFMembershipService { CreateContext = () => _connection.GetContext() }; _repos = new EFRepositoryRepository { CreateContext = () => _connection.GetContext() }; _roles = new EFRoleProvider { CreateContext = () => _connection.GetContext() }; _service = new RepositoryPermissionService { Repository = _repos, TeamRepository = _teams, RoleProvider = _roles }; new AutomaticUpdater().RunWithContext(_connection.GetContext()); }
private void UpdateRepo(Guid repoId, Action<RepositoryModel> transform) { EFRepositoryRepository repoRepo = new EFRepositoryRepository { CreateContext = GetContext }; var repo = repoRepo.GetRepository(repoId); transform(repo); repoRepo.Update(repo); }
/// <summary> /// A check-permission routine which runs checks by both name and Guid, and makes sure they agree /// </summary> private bool CheckPermission(Guid userId, Guid repoId) { bool byGuid = _service.HasPermission(userId, repoId); EFRepositoryRepository repoRepo = new EFRepositoryRepository { CreateContext = GetContext }; bool byName = _service.HasPermission(userId, repoRepo.GetRepository(repoId).Name); Assert.IsTrue(byGuid == byName); return byGuid; }
private Guid AddRepo(string name) { var newRepo = new RepositoryModel(); newRepo.Name = name; newRepo.Users = new UserModel[0]; newRepo.Administrators = new UserModel[0]; newRepo.Teams = new TeamModel[0]; EFRepositoryRepository repoRepo = new EFRepositoryRepository { CreateContext = GetContext }; Assert.IsTrue(repoRepo.Create(newRepo)); return newRepo.Id; }
protected void InitialiseTestObjects() { _repo = new EFRepositoryRepository {CreateContext = () => _connection.GetContext()}; new AutomaticUpdater().RunWithContext(_connection.GetContext()); }