/// <summary> /// Executes the <see cref="MethodUnderTest"/> synchronously. /// </summary> /// <returns>The <see cref="Task"/> representing the result of the asynchronous operation.</returns> private Task ExecuteAsynchronously() { try { var result = (Task)MethodUnderTest.Invoke(Sut, _parameters); return(result); } catch (TargetInvocationException targetInvocationException) { if (targetInvocationException.InnerException == null) { throw; } throw targetInvocationException.InnerException; } }
/// <summary> /// Executes the <see cref="MethodUnderTest"/> synchronously. /// </summary> private void ExecuteSynchronously() { try { object result = MethodUnderTest.Invoke(Sut, _parameters); if (result is IEnumerable enumerable) { enumerable.GetEnumerator().MoveNext(); } } catch (TargetInvocationException targetInvocationException) { if (targetInvocationException.InnerException == null) { throw; } throw targetInvocationException.InnerException; } }