title: FakeItEasy, Fake a parents virtual method from the child class
body: <p>I am trying to fake a call to a parents public virtual validate method from the child without success (using <code>FakeItEasy</code>. I have a base class that validates simple commands for similar command classes (I have reduced the code for simplicity sake):</p>
  
  <pre><code>  public class CanSetSettings&lt;TSettings&gt; : IValidationhandler&lt;TSettings&gt; where TSettings : ISetting
    {
      protected readonly IFooRepository Repository;
      protected List&lt;ValidationResult&gt; Results;
  
      public CanSetSettings(IFooRepository repository)
      {
        if (Repository== null)
          throw new ArgumentNullException("IFooRepository ", "IFooRepository is needed to validate the command.");
  
        repository = repository;
        Results = new List&lt;ValidationResult&gt;();
      }
  
      public virtual ICollection&lt;ValidationResult&gt; Validate(TSettings settings)
      {
        if (settings == null)
        {
          Results.Add(new ValidationResult("Settings", "The command to validate cannot be missing."));
          return Results;
        }
  
        if (Repository.Query(settings.Location) == null)
          Results.Add(new ValidationResult("Location", "No Location was found for your settings."));
  
        return Results;
      }
  </code></pre>
  
  <p>Then I have child classes that inherits from this base class and then implements their specific logic by overriding <code>Validate</code> (simplified my code).</p>
  
  <pre><code>public class CanSetSpecificSetting : CanSetSettings&lt;SetSpecificSettings&gt;, IValidationhandler&lt;SetSpecificSettings&gt;
    {
      public CanSetSpecificSetting (IFooRepository repo)
        : base(repo)
      { }
  
      public override ICollection&lt;ValidationResult&gt; Validate(SetSpecificSettings command)
      {
        base.Validate(command); // TODO determine if this call was made
  
      // ... other logic here
  
        return results;
      }
    }
  </code></pre>
  
  <p>I have tried this in my unit test and it only configures the method call to the child class and I cannot configure the parent. How do I configure the fake to call the child class and fake the parent base class method? Thank you.</p>
  
  <pre><code>      var _repository = A.Fake&lt;IFooRepository&gt;();
        var _validator = A.Fake&lt;CanSetSpecificSetting&gt;(opt =&gt; opt.WithArgumentsForConstructor(new object[] { _repository }));
  
        A.CallTo(() =&gt; _validator.Validate(_cmd)).CallsBaseMethod().Once();
  
        _validator.Validate(_cmd);
  
        // this passes, but only because it knows about the child call
        A.CallTo(() =&gt; _validator.Validate(_cmd)).MustHaveHappened(Repeated.Exactly.Once);
  </code></pre>