public void ChangeOwner() { testContext.CreateAdminTeam(); var team = CreateNestedTeam(); controller.ChangeOwner(team.Id, testContext.users[10].Id, testContext.adminUsers[0]); var fetchedTeam = controller.Get(team.Id, testContext.adminUsers[0]); Assert.Equal(testContext.users[10].Id, fetchedTeam.Acl.ownerId); // Admin Team Writer controller.ChangeOwner(team.Id, testContext.users[11].Id, testContext.adminUsers[1]); fetchedTeam = controller.Get(team.Id, testContext.adminUsers[1]); Assert.Equal(testContext.users[11].Id, fetchedTeam.Acl.ownerId); // Admin Team Nested reader team writer controller.ChangeOwner(team.Id, testContext.users[10].Id, testContext.adminUsers[2]); fetchedTeam = controller.Get(team.Id, testContext.adminUsers[2]); Assert.Equal(testContext.users[10].Id, fetchedTeam.Acl.ownerId); // Admin Team Writer controller.ChangeOwner(team.Id, testContext.users[11].Id, testContext.adminUsers[3]); fetchedTeam = controller.Get(team.Id, testContext.adminUsers[3]); Assert.Equal(testContext.users[11].Id, fetchedTeam.Acl.ownerId); // Admin Team Nested reader team writer controller.ChangeOwner(team.Id, testContext.users[10].Id, testContext.adminUsers[4]); fetchedTeam = controller.Get(team.Id, testContext.adminUsers[4]); Assert.Equal(testContext.users[10].Id, fetchedTeam.Acl.ownerId); // Team Owner reader team writer controller.ChangeOwner(team.Id, testContext.users[11].Id, testContext.users[0]); fetchedTeam = controller.Get(team.Id, testContext.users[0]); Assert.Equal(testContext.users[11].Id, fetchedTeam.Acl.ownerId); // Team Writer controller.ChangeOwner(team.Id, testContext.users[10].Id, testContext.users[1]); fetchedTeam = controller.Get(team.Id, testContext.users[1]); Assert.Equal(testContext.users[10].Id, fetchedTeam.Acl.ownerId); // Team Reader Assert.Throws <NotAuthorized>(() => controller.ChangeOwner(team.Id, testContext.users[11].Id, testContext.users[2])); fetchedTeam = controller.Get(team.Id, testContext.users[2]); Assert.Equal(testContext.users[10].Id, fetchedTeam.Acl.ownerId); // Nested Team Writer writer controller.ChangeOwner(team.Id, testContext.users[11].Id, testContext.users[3]); fetchedTeam = controller.Get(team.Id, testContext.users[3]); Assert.Equal(testContext.users[11].Id, fetchedTeam.Acl.ownerId); // Nested Team Writer reader controller.ChangeOwner(team.Id, testContext.users[10].Id, testContext.users[4]); fetchedTeam = controller.Get(team.Id, testContext.users[4]); Assert.Equal(testContext.users[10].Id, fetchedTeam.Acl.ownerId); // Nested Team Reader writerter"); Assert.Throws <NotAuthorized>(() => controller.ChangeOwner(team.Id, testContext.users[11].Id, testContext.users[5])); fetchedTeam = controller.Get(team.Id, testContext.users[5]); Assert.Equal(testContext.users[10].Id, fetchedTeam.Acl.ownerId); // Nested Team reader readerder"); Assert.Throws <NotAuthorized>(() => controller.ChangeOwner(team.Id, testContext.users[12].Id, testContext.users[6])); fetchedTeam = controller.Get(team.Id, testContext.users[6]); Assert.Equal(testContext.users[10].Id, fetchedTeam.Acl.ownerId); Assert.Throws <NotAuthorized>(() => controller.ChangeOwner(team.Id, testContext.users[13].Id, testContext.users[7])); Assert.Throws <NotAuthorized>(() => fetchedTeam = controller.Get(team.Id, testContext.users[7])); Assert.Equal(testContext.users[10].Id, fetchedTeam.Acl.ownerId); }