/// <summary> /// Sets up a Fake's members so that the return, out, and ref values will be retrieved /// from the fixture, instead of being created directly by FakeItEasy. /// </summary> /// <param name="specimen">The Fake to setup.</param> /// <param name="context">The context of the Fake.</param> public void Execute(object specimen, ISpecimenContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var fakeManager = GetFakeManager(specimen); if (fakeManager == null) { return; } var resultCache = new CallResultCache(); fakeManager.AddRuleLast(new PropertySetterRule(resultCache)); fakeManager.AddRuleLast(new MethodRule(context, resultCache)); }
public MethodRule(ISpecimenContext context, CallResultCache resultSource) { this.context = context; this.resultSource = resultSource; }
public PropertySetterRule(CallResultCache resultCache) { this.resultCache = resultCache; }