Exemplo n.º 1
0
        public async Task <ActionResult <CaseStatusModel> > GetCaseStatus(int caseId)
        {
            if (caseId < 1)
            {
                return(UnprocessableEntity($"Invalid CaseId: {caseId}"));
            }
            CaseStatusModel caseStatus = await _courtCasesService.GetCaseStatusAsync(caseId);

            if (caseStatus is null)
            {
                return(NotFound());
            }
            return(Ok(caseStatus));
        }
Exemplo n.º 2
0
        public async Task GetCaseStatus_NotFound()
        {
            // Arrange
            int             caseId   = 1;
            CaseStatusModel expected = null;

            _mockCourtCasesService.GetCaseStatusAsync(caseId).Returns(expected);

            // Act
            ActionResult <CaseStatusModel> response = await _sut.GetCaseStatus(caseId);

            // Assert
            await _mockCourtCasesService.Received(1).GetCaseStatusAsync(caseId);

            Assert.IsType <NotFoundResult>(response.Result);
        }