title: NSubstitute virtual getter returning substitution using ForPartsOf throws exception
body: <p>I am trying to mock one property of an object</p>
  
  <p>There is a <strong>similar question:</strong> <a href="https://stackoverflow.com/questions/16643526/returning-the-result-of-a-method-that-returns-another-substitute-throws-an-excep">Returning the result of a method that returns another substitute throws an exception in NSubstitute</a>
  But the accepted answer is not working for me.</p>
  
  <pre><code>void Main()
  {
      var obj = Substitute.ForPartsOf&lt;MyObject&gt;();
      //WORKS, But I need a partial mock!:
      //var obj = Substitute.For&lt;MyObject&gt;();
  
      obj.PropClass.Returns(Substitute.For&lt;PropClass&gt;());
  
      //It's suggestion, Fails, same error:
      //var returnValue = Substitute.For&lt;PropClass&gt;();
      //obj.PropClass.Returns(returnValue);
  
      //Fails, same error:
      //Lazy implementation of *similar question*
      //Func&lt;PropClass&gt; hello = () =&gt; Substitute.For&lt;PropClass&gt;();
      //obj.PropClass.Returns(x =&gt; hello());
  
      //Fails, same error:
      //I believe what *similar question* suggests
      //obj.PropClass.Returns(x =&gt; BuildSub());
  
      obj.PropClass.Dump("Value");
  }
  
  public class MyObject
  {
      public MyObject()
      {
          _propClasses = new List&lt;PropClass&gt;();
      }
      private readonly IList&lt;PropClass&gt; _propClasses;
      public virtual IEnumerable&lt;PropClass&gt; PropClasses { get { return _propClasses; } }
      public virtual PropClass PropClass { get { return PropClasses.FirstOrDefault(); } }
  }
  public class PropClass
  {
  }
  
  public PropClass BuildSub()
  {
      return Substitute.For&lt;PropClass&gt;();
  }
  </code></pre>
  
  <p>These fail with the exception:</p>
  
  <pre><code>CouldNotSetReturnDueToTypeMismatchException:
  Can not return value of type PropClassProxy_9 for MyObject.get_PropClasses (expected type IEnumerable`1).
  
  Make sure you called Returns() after calling your substitute (for example: mySub.SomeMethod().Returns(value)),
  and that you are not configuring other substitutes within Returns() (for example, avoid this: mySub.SomeMethod().Returns(ConfigOtherSub())).
  
  If you substituted for a class rather than an interface, check that the call to your substitute was on a virtual/abstract member.
  Return values cannot be configured for non-virtual/non-abstract members.
  
  Correct use:
    mySub.SomeMethod().Returns(returnValue);
  
  Potentially problematic use:
    mySub.SomeMethod().Returns(ConfigOtherSub());
  Instead try:
    var returnValue = ConfigOtherSub();
    mySub.SomeMethod().Returns(returnValue);
  </code></pre>