async void ExecFromRequires_NotNullInput() { var transformerMock = new Mock <ILazy <ITransformationManager> >(); var handler = new IntegerInputOnlyHandler(transformerMock.Object); var exception = await Assert.ThrowsAsync <ArgumentNullException>(() => handler.ExecFromAsync <double?>(null)); Assert.Equal("from", exception.ParamName); }
async void ExecFrom_DoesNotExecute_WhenInputIsAlreadyOfThe_ExpectedType() { var transformerMock = new Mock <ILazy <ITransformationManager> >(); var handler = new IntegerInputOnlyHandler(transformerMock.Object); var exception = await Assert.ThrowsAsync <BusinessLayerException>(() => handler.ExecFromAsync <string>("notnull")); Assert.Equal( "The input object is already of the expected type. You should use Exec() instead of Exec<>()", exception.Message); }
async void ExecFrom_RaisesException_WhenThenTransformer_ReturnsNull() { var transformerMock = new Mock <ILazy <ITransformationManager> >(); transformerMock.Setup(s => s.Value.Transform <int, string>(It.IsAny <int>())) .Returns((string)null); var handler = new IntegerInputOnlyHandler(transformerMock.Object); var exception = await Assert.ThrowsAsync <BusinessLayerException>(() => handler.ExecFromAsync(0)); Assert.Equal("The input type cannot be transformed to the expected type properly", exception.Message); }