public async Task WhenProjectIdExists_ThenQueryProjectsByIdReturnsProject( [Credential(Role = PredefinedRole.ComputeViewer)] ResourceTask <ICredential> credential) { using (var adapter = new ResourceManagerAdapter(await credential)) { var result = await adapter.ListProjects( ProjectFilter.ByProjectId(TestProject.ProjectId), null, CancellationToken.None); Assert.IsNotNull(result); Assert.IsFalse(result.IsTruncated); Assert.AreEqual(1, result.Projects.Count()); Assert.AreEqual(TestProject.ProjectId, result.Projects.First().ProjectId); } }
public async Task WhenProjectIdExists_ThenQueryProjectsByPrefixReturnsProject( [Credential(Role = PredefinedRole.ComputeViewer)] ResourceTask <ICredential> credential) { using (var adapter = new ResourceManagerAdapter(await credential)) { // Remove last character from project ID. var prefix = TestProject.ProjectId.Substring(0, TestProject.ProjectId.Length - 1); var result = await adapter.ListProjects( ProjectFilter.ByPrefix(prefix), 10, CancellationToken.None); Assert.IsNotNull(result); Assert.IsTrue(result.Projects.Any()); CollectionAssert.Contains( result.Projects.Select(p => p.ProjectId), TestProject.ProjectId); } }