Example #1
0
        public async Task Returns400IfPrereqChecksFailsForGetRefreshFundingJobPrereqErrors()
        {
            string errorMessage = "calc error";

            ApiSpecificationSummary specificationSummary = NewApiSpecificationSummary(_ => _.WithId(SpecificationId));

            GivenTheApiResponseDetailsForTheSuppliedId(specificationSummary);

            AndGetPreReqCheckerLocatorReturnsRefreshPreReqChecker();
            AndPrereqChecksFails(specificationSummary, errors: new[] { errorMessage });

            await WhenGetRefreshFundingJobPrereqErrors();

            ThenTheResponseShouldBe <BadRequestObjectResult>();

            BadRequestObjectResult objectResult = ActionResult as BadRequestObjectResult;

            objectResult.Should().NotBeNull();
            objectResult.Value.Should().BeOfType <SerializableError>();

            SerializableError errors = objectResult.Value as SerializableError;

            errors.Should().NotBeNull();
            errors.Count.Should().Be(1);

            errors.FirstOrDefault().Value.Should().BeOfType <string[]>();

            string[] errorArray = errors.FirstOrDefault().Value as string[];

            errorArray.Should().NotBeNull();
            errorArray.Length.Should().Be(1);

            errorArray.FirstOrDefault().Should().Be(errorMessage);
        }