public void DerivationExceptionConstructorErrorMessageInnerExceptionTest() { var exception = new DerivationException(ErrorMessage, InnerException); Assert.AreEqual(exception.Message, ErrorMessage); Assert.AreEqual(exception.InnerException, InnerException); }
public void DerivationExceptionConstructorErrorMessageDerivorTypeSourceValueDestValueTest() { var exception = new DerivationException(ErrorMessage, DerivorType, SourceValue, DestValue); Assert.AreEqual(exception.Message, ErrorMessage); Assert.AreEqual(exception.SourceValue, SourceValue); Assert.AreEqual(exception.DestValue, DestValue); Assert.AreEqual(exception.DerivorType, DerivorType); }
public async Task WrapsExceptionInTransformExceptionNullTransformer() { DerivationException thrownEx = null; try { await new DerivationService <string, bool>(null).Derive(null, false); } catch (DerivationException dex) { thrownEx = dex; } Assert.IsInstanceOfType(thrownEx, typeof(DerivationException)); }
public async Task WrapsExceptionInDerivationException() { DerivationException thrownEx = null; try { await new TestDerivor <string, bool>((s, b) => { throw GeneralException; }).Derive(bool.TrueString, false); } catch (DerivationException dex) { thrownEx = dex; } Assert.IsInstanceOfType(thrownEx, typeof(DerivationException)); Assert.AreEqual(GeneralException, thrownEx.InnerException); }
public async Task RethrowsDerivationException() { DerivationException thrownEx = null; try { await new TestDerivor <string, bool>((s, b) => { throw DerivationException; }).Derive(bool.TrueString, false); } catch (DerivationException dex) { thrownEx = dex; } Assert.AreEqual(DerivationException, thrownEx); }
public async Task RethrowsTransformException() { DerivationException thrownEx = null; try { DerivorMock.Setup(transform => transform.Derive(null, false, It.IsAny <CancellationToken>())) .Throws(DerivationException); await DerivationService.Derive(null, false); } catch (DerivationException dex) { thrownEx = dex; } Assert.AreEqual(DerivationException, thrownEx); DerivorMock.Verify(transform => transform.Derive(null, false, It.IsAny <CancellationToken>()), Times.Once); DerivorMock.VerifyNoOtherCalls(); DerivorMock.Reset(); }
public async Task WrapsExceptionInTransformException() { DerivationException thrownEx = null; try { DerivorMock.Setup(transform => transform.Derive(null, false, It.IsAny <CancellationToken>())) .Throws(GeneralException); await DerivationService.Derive(null, false); } catch (DerivationException dex) { thrownEx = dex; } Assert.IsInstanceOfType(thrownEx, typeof(DerivationException)); Assert.AreEqual(GeneralException, thrownEx.InnerException); DerivorMock.Verify(transform => transform.Derive(null, false, It.IsAny <CancellationToken>()), Times.Once); DerivorMock.VerifyNoOtherCalls(); DerivorMock.Reset(); }
public void DerivationExceptionConstructor() { var exception = new DerivationException(); Assert.IsInstanceOfType(exception, typeof(DerivationException)); }