NSubstitute - faking a virtual method that calls another virtual method
<p>I have a class that looks something like this:</p>
<pre><code>public class MyClass
{
    public virtual bool A()
    {
        return 5 &lt; B();
    }

    protected virtual int B()
    {
        return new Random.Next(1, 10);
    }
}
</code></pre>
<p>When writing tests for <code>MyClass</code> it would be handy to be able to do the following:</p>
<pre><code>[Fact]
public void Blabla()
{
    var o = Substitute.ForPartsOf&lt;MyClass&gt;();
    o.A().Returns(true);

    Assert.True(o.DoSomethingElse());
}
</code></pre>
<p>However, this doesn't work. I get a runtime exception:</p>
<blockquote>
<p>NSubstitute.Exceptions.CouldNotSetReturnDueToTypeMismatchException</p>
<p>Can not return value of type Boolean for MyClass.A (expected type int).</p>
</blockquote>
<p>Is there a way to get around this, or do I have to create a concrete test double class overriding <code>A</code>?</p>