public async Task GetJobProfileDetailTestsReturnsOKAndViewModelWhenReturnedFromProfileDataService()
        {
            // Arrange
            var expectedModel = GetJobProfileApiModel();

            A.CallTo(() => profileDataService.GetJobProfile(A <string> .Ignored)).Returns(expectedModel);

            // Act
            var result = await functionApp.GetJobProfileDetail(httpRequest, CanonicalName, profileDataService).ConfigureAwait(false);

            // Assert
            var okResult           = Assert.IsType <OkObjectResult>(result);
            var deserialisedResult = JsonConvert.DeserializeObject <JobProfileApiModel>(okResult.Value.ToString());

            Assert.Equal((int)HttpStatusCode.OK, okResult.StatusCode);
            deserialisedResult.Should().BeEquivalentTo(expectedModel);
        }
        public async Task <IActionResult> GetJobProfileDetail(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "{canonicalName}")] HttpRequest request,
            string canonicalName,
            [Inject] IProfileDataService dataService)
        {
            request.LogRequestHeaders(logService);

            var jobProfile = await dataService.GetJobProfile(canonicalName).ConfigureAwait(false);

            if (jobProfile is null)
            {
                logService.LogMessage($"Job Profile with name {canonicalName} does not exist", SeverityLevel.Warning);
                return(responseWithCorrelation.ResponseWithCorrelationId(HttpStatusCode.NoContent));
            }

            jobProfile.RelatedCareers?.ForEach(r => r.Url = request.GetAbsoluteUrlForRelativePath(r.Url.TrimStart('/')));
            jobProfile.Url = request.GetAbsoluteUrlForRelativePath(jobProfile.Url?.TrimStart('/'));

            return(responseWithCorrelation.ResponseObjectWithCorrelationId(jobProfile));
        }