Exemple #1
0
        public async Task GetDistinctFundingStreamsForSpecifications_Returns_Bad_Request_Given_Api_Returns_Bad_Request_Status()
        {
            _specificationsApiClient
            .GetDistinctFundingStreamsForSpecifications()
            .Returns(Task.FromResult(new ApiResponse <IEnumerable <string> >(HttpStatusCode.BadRequest)));

            IActionResult result = await _specificationController.GetDistinctFundingStreamsForSpecifications();

            result.Should().BeOfType <BadRequestResult>();
        }
        public async Task <IActionResult> GetDistinctFundingStreamsForSpecifications()
        {
            ApiResponse <IEnumerable <string> > apiResponse = await _specificationsApiClient.GetDistinctFundingStreamsForSpecifications();

            if (apiResponse.StatusCode == HttpStatusCode.OK)
            {
                return(Ok(apiResponse.Content));
            }

            if (apiResponse.StatusCode == HttpStatusCode.BadRequest)
            {
                return(new BadRequestResult());
            }

            return(new StatusCodeResult(500));
        }