public async Task ResourceDiscovery_GetForUnexistingResourceCollection_ReturnsNotFound() { // Arrange string resourceCollectionName = _bogusGenerator.Lorem.Word(); var resourceDiscoveryClient = new ResourceDiscoveryClient(Configuration, Logger); // Act var response = await resourceDiscoveryClient.GetDiscoveredResourcesAsync(resourceCollectionName); // Assert Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); }
public async Task ResourceDiscovery_SuccessfulCall_ReturnsVersionHeader() { // Arrange const string resourceDiscoveryGroupName = "logic-apps-unfiltered"; var resourceDiscoveryClient = new ResourceDiscoveryClient(Configuration, Logger); // Act var response = await resourceDiscoveryClient.GetDiscoveredResourcesAsync(resourceDiscoveryGroupName); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.True(response.Headers.Contains(HttpHeaders.AgentVersion)); Assert.Equal(ExpectedVersion, response.Headers.GetFirstOrDefaultHeaderValue(HttpHeaders.AgentVersion)); }
public async Task ResourceDiscovery_GetForUnexistingResourceDiscoveryGroup_ReturnsNotFound() { // Arrange string resourceDiscoveryGroupName = _bogusGenerator.Lorem.Word(); var resourceDiscoveryClient = new ResourceDiscoveryClient(Configuration, Logger); // Act var response = await resourceDiscoveryClient.GetDiscoveredResourcesAsync(resourceDiscoveryGroupName); // Assert Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); Assert.True(response.Headers.Contains(HttpHeaders.AgentVersion)); Assert.Equal(ExpectedVersion, response.Headers.GetFirstOrDefaultHeaderValue(HttpHeaders.AgentVersion)); }
public async Task ResourceDiscovery_GetWithFilterOnTwoResourceGroups_ReturnsExpectedAmount() { // Arrange const string resourceCollectionName = "two-resource-group-scenario"; const int expectedResourceCount = 4; var resourceDiscoveryClient = new ResourceDiscoveryClient(Configuration, Logger); // Act var response = await resourceDiscoveryClient.GetDiscoveredResourcesAsync(resourceCollectionName); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); var rawResponseBody = await response.Content.ReadAsStringAsync(); Assert.NotEmpty(rawResponseBody); var resources = JsonConvert.DeserializeObject <List <Resource> >(rawResponseBody); Assert.NotNull(resources); Assert.Equal(expectedResourceCount, resources.Count); }
public async Task ResourceDiscovery_GetAllPerResourceTypeWithoutFilters_ReturnsExpectedAmount() { // Arrange const string resourceDiscoveryGroupName = "logic-apps-unfiltered"; const int expectedResourceCount = 22; var resourceDiscoveryClient = new ResourceDiscoveryClient(Configuration, Logger); // Act var response = await resourceDiscoveryClient.GetDiscoveredResourcesAsync(resourceDiscoveryGroupName); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); var rawResponseBody = await response.Content.ReadAsStringAsync(); Assert.NotEmpty(rawResponseBody); var resources = JsonConvert.DeserializeObject <List <Resource> >(rawResponseBody); Assert.NotNull(resources); Assert.Equal(expectedResourceCount, resources.Count); }