public async void ReturnProjectMetricsGivenValidArgs()
        {
            // arrange
            const string projectKey = "asdf";
            const string expected   = "{'name' : 'Test McGee'}";
            const string metric     = "sqale_rating";

            var settings = new SonarQubeSettings()
            {
                HostURL = "http://example.org"
            };

            var mockHttp = new MockHttpMessageHandler();

            mockHttp.When($"{settings.HostURL}/api/measures/component?component={projectKey}&metricKeys={metric}")
            .Respond("application/json", expected);

            HttpClient httpClient = new HttpClient(mockHttp);

            SonarQubeApiClient apiClient = new SonarQubeApiClient(settings, httpClient);

            // act
            var jsonObject = await apiClient.GetProjectMetrics(projectKey, metric);

            // assert
            var actual = JsonConvert.SerializeObject(jsonObject);

            Assert.Equal(FormatJson(expected), FormatJson(actual));
        }
        public async Task <IActionResult> Get(string projectKey)
        {
            logger.LogInformation($"Serving badge for route {Request.Path} [{projectKey}]");

            var projectMetrics = await apiClient.GetProjectMetrics(projectKey, "sqale_rating");

            string sqaleRating = ExtractSqaleFromMetrics(projectMetrics);

            var badgeName = GetBadgeContentForSqualeRating(sqaleRating);

            return(new FileStreamResult(new FileStream($"images/badges/{badgeName}", FileMode.Open), "image/svg+xml"));
        }