public void SetResult_is_noop_when_not_implemented() { var handler = new Mock <HandlerBase>(); var wrappedHandler = new WrappedResultHandler(handler.Object); wrappedHandler.SetResult("Value1"); }
public void SetResult_invokes_when_implemented() { var handler = new Mock <HandlerBase>().As <IResultHandler>(); var wrappedHandler = new WrappedResultHandler(handler.Object); wrappedHandler.SetResult("Value1"); handler.Verify(h => h.SetResult("Value1")); }
/// <summary> /// Executes an action passing the result or exceptions to the handler. /// </summary> /// <typeparam name="T"> The result type. </typeparam> /// <param name="action"> The action to execute. </param> protected virtual void Execute <T>(Func <T> action) { Check.NotNull(action, nameof(action)); Execute(() => _handler.SetResult(action())); }