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);
        }
예제 #2
0
        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));
        }
예제 #3
0
        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);
        }
예제 #5
0
        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);
        }