public void Intercept(IInvocation invocation) { if (invocation.Method.IsAbstract) { _cachedGeneration.SetupReturnValueFor(invocation, _instanceSource, _trace); } else if (invocation.Method.IsVirtual) { try { var previousReturnValue = invocation.ReturnValue; invocation.Proceed(); if (invocation.ReturnValue == previousReturnValue) { _cachedGeneration.SetupReturnValueFor(invocation, _instanceSource, _trace); } } catch (Exception) { _cachedGeneration.SetupReturnValueFor(invocation, _instanceSource, _trace); } } }
public void Intercept(IInvocation invocation) { NSubstituteHacks.AssertIsNotInvokedDuringNSubstituteQuery(invocation, _instanceSource); if (invocation.Method.IsAbstract) { _cachedGeneration.SetupReturnValueFor(invocation, _instanceSource, _request); } else if (invocation.Method.IsVirtual) { try { var previousReturnValue = invocation.ReturnValue; invocation.Proceed(); if (invocation.ReturnValue == previousReturnValue) { _cachedGeneration.SetupReturnValueFor(invocation, _instanceSource, _request); } } catch (Exception) { _cachedGeneration.SetupReturnValueFor(invocation, _instanceSource, _request); } } }
public void Intercept(IInvocation invocation) { _cachedGeneration.SetupReturnValueFor(invocation, _instanceSource, _trace); }
public void Intercept(IInvocation invocation) { NSubstituteHacks.AssertIsNotInvokedDuringNSubstituteQuery(invocation, _instanceSource); _cachedGeneration.SetupReturnValueFor(invocation, _instanceSource, _request); }