public void When_GetByPropRef_ArrearsActionUsecase_method_is_called__Then_usecase_calls_the_gateway()
        {
            // arrange

            // act
            _usecaseUnderTest.GetByPropRef(new GetAractionsByPropRefRequest());

            // assert
            _mockGateway.Verify(u => u.GetByPropRef(It.IsAny <string>()), Times.Once);
        }
Exemple #2
0
        public IActionResult GetAractionsByPropRef([FromRoute] GetAractionsByPropRefRequest request)
        {
            try
            {
                var validation_result = _getByPropRefValidator.Validate(request);

                if (validation_result.IsValid)
                {
                    var usecase_result = _arrearsActionUsecase.GetByPropRef(request);

                    return(Ok(usecase_result));
                }

                return(BadRequest(
                           new ErrorResponse(validation_result.Errors)
                           ));
            }
            catch (NotFoundException ex)
            {
                return(NotFound(new ErrorResponse(ex.Message)));
            }
            catch (Exception ex) when(ex.InnerException != null)
            {
                return(StatusCode(500, new ErrorResponse(ex.Message, ex.InnerException.Message)));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, new ErrorResponse(ex.Message)));
            }
        }