public async Task HasAllTemplateCalculationsBeenApproved_GivenResponseIsSuccess_ReturnsValue(bool expectedValue) { //Arrange BooleanResponseModel booleanResponseModel = new BooleanResponseModel { Value = expectedValue }; ApiResponse <BooleanResponseModel> apiResponse = new ApiResponse <BooleanResponseModel>(HttpStatusCode.OK, booleanResponseModel); ICalculationsApiClient calculationsApiClient = CreateCalculationsApiClient(); calculationsApiClient .CheckHasAllApprovedTemplateCalculationsForSpecificationId(Arg.Is(specificationId)) .Returns(apiResponse); CalculationsService calculationsService = CreateCalculationsService(calculationsApiClient); //Act bool responseValue = await calculationsService.HaveAllTemplateCalculationsBeenApproved(specificationId); //Assert responseValue .Should() .Be(expectedValue); }
public async Task CheckHasAllApprovedTemplateCalculationsForSpecificationId_GivenResult_ReturnsExpectedResponseValue(int result, bool expected) { //Arrange ICalculationsRepository calculationsRepository = CreateCalculationsRepository(); calculationsRepository .GetCountOfNonApprovedTemplateCalculations(Arg.Is(SpecificationId)) .Returns(result); CalculationService calculationService = CreateCalculationService(calculationsRepository: calculationsRepository); //Act IActionResult actionResult = await calculationService.CheckHasAllApprovedTemplateCalculationsForSpecificationId(SpecificationId); //Assert BooleanResponseModel responseModel = (actionResult as OkObjectResult).Value as BooleanResponseModel; responseModel .Value .Should() .Be(expected); }