public async Task WhenUserNotInRole_ThenGetProjectThrowsResourceAccessDeniedException( [Credential(Role = PredefinedRole.IapTunnelUser)] ResourceTask <ICredential> credential) { using (var adapter = new ResourceManagerAdapter(await credential)) { AssertEx.ThrowsAggregateException <ResourceAccessDeniedException>( () => adapter.GetProjectAsync( TestProject.ProjectId, CancellationToken.None).Wait()); } }
public async Task WhenUserInViewerRole_ThenGetProjectReturnsProject( [Credential(Role = PredefinedRole.ComputeViewer)] ResourceTask <ICredential> credential) { using (var adapter = new ResourceManagerAdapter(await credential)) { var project = await adapter.GetProjectAsync( TestProject.ProjectId, CancellationToken.None); Assert.IsNotNull(project); Assert.AreEqual(TestProject.ProjectId, project.ProjectId); } }