public async Task GetCaseDetails_UnprocessableEntity() { // Arrange int caseId = 0; string expectedError = $"Invalid CaseId: {caseId}"; // Act ActionResult <CaseDetailsModel> response = await _sut.GetCaseDetails(caseId); // Assert await _mockCourtCasesService.DidNotReceive().RetrieveAsync(caseId); var createdAtActionResult = Assert.IsType <UnprocessableEntityObjectResult>(response.Result); Assert.Equal(expectedError, createdAtActionResult.Value); }