/// <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));
        }
Ejemplo n.º 2
0
 public MethodRule(ISpecimenContext context, CallResultCache resultSource)
 {
     this.context      = context;
     this.resultSource = resultSource;
 }
Ejemplo n.º 3
0
 public PropertySetterRule(CallResultCache resultCache)
 {
     this.resultCache = resultCache;
 }