/// <summary> /// Called when the mocked method is called. /// THis implementation logs before and after the method has been called, along with any exceptions thrown. /// </summary> /// <param name="mockInfo">Information about the mock through which the method is called.</param> /// <param name="param">The parameters used.</param> /// <returns>The returned result.</returns> public override TResult Call(IMockInfo mockInfo, TParam param) { if (_hasParameters) { _logContext.LogBeforeMethodCallWithParameters(mockInfo, param); } else { _logContext.LogBeforeMethodCallWithoutParameters(mockInfo); } TResult result; try { result = base.Call(mockInfo, param); } catch (Exception exception) { _logContext.LogMethodCallException(mockInfo, exception); throw; } if (_hasResult) { _logContext.LogAfterMethodCallWithResult(mockInfo, result); } else { _logContext.LogAfterMethodCallWithoutResult(mockInfo); } return(result); }