public void ThrowsExceptionWhenDBThrowsException() { var expected = new Exception("DB Exception"); _db.Setup(x => x.CarrierScacs).Throws(expected); InitService(); Func <Task> action = async() => await _svc.GetAllCarrierScacsAsync(); action.Should().Throw <Exception>(expected.Message); }
public async Task <IActionResult> GetAll() { try { return(Success(await _carrierService.GetAllCarrierScacsAsync())); } catch (Exception ex) { return(Error <List <CarrierData> >(ex)); } }