static bool CanBeConfigured(IndirectionStubSpecimen stub) { var dlgtMethod = stub.IndirectionDelegateMethod; return(!dlgtMethod.IsGenericMethod && !dlgtMethod.HasRefParameters() && (!dlgtMethod.IsVoid() || dlgtMethod.HasOutParameters())); }
public void AddStub(IndirectionStubSpecimen stub) { if (stub == null) { throw new ArgumentNullException("stub"); } m_stubs.Add(stub); }
void SetAutoBody(IndirectionStubSpecimen stub, ISpecimenContext context) { var proxy = default(MockProxy); var dlgtType = default(Type); var dlgtMethod = default(MethodInfo); using (InstanceGetters.DisableProcessing()) { dlgtType = stub.IndirectionDelegate; dlgtMethod = stub.IndirectionDelegateMethod; } proxy = GetAutoMock(dlgtType, dlgtMethod, context); stub.SetBody(proxy.Object); using (InstanceGetters.DisableProcessing()) m_ms.Assign(stub.CallableTarget, proxy); }