示例#1
0
 public Task <ExceptionResponse> Map(System.Exception exception)
 {
     return(exception switch
     {
         DomainException ex => _exceptionResponseFactory.Create(ex),
         AppException ex => _exceptionResponseFactory.Create(ex),
         InfrastructureException ex => _exceptionResponseFactory.Create(ex),
         _ => _exceptionResponseFactory.Create("error", "There was an error")
     });
示例#2
0
 public async Task Create_CreateExceptionResponseFromAppException_TypeShouldBeExceptionResponse()
 => (await _factory.Create(new TestException(""))).ShouldBeAssignableTo(typeof(ExceptionResponse));