public async Task GetCalculationByCalculationSpecificationId_GivenAnInvalidRequest_ShouldReturnBadRequest() { //Arrange HttpRequest request = Substitute.For <HttpRequest>(); ILogger logger = CreateLogger(); CalculationService service = CreateCalculationService(logger: logger); //Act IActionResult result = await service.GetCalculationByCalculationSpecificationId(null); //Assert result .Should() .BeOfType <BadRequestObjectResult>(); }
public async Task GetCalculationByCalculationSpecificationId_GivenACalculationIsNotFound_ShouldReturnNotFoundObjectResult() { //Arrange const string calcSpecId = "CalcSpecId"; ICalculationsRepository mockCalculationRepository = Substitute.For <ICalculationsRepository>(); mockCalculationRepository .GetCalculationByCalculationSpecificationId(calcSpecId) .Returns(Task.FromResult((Calculation)null)); CalculationService service = CreateCalculationService(calculationsRepository: mockCalculationRepository); //Act IActionResult result = await service.GetCalculationByCalculationSpecificationId(calcSpecId); //Assert result .Should() .BeOfType <NotFoundObjectResult>(); }