NSubstitute does not support saying "forward every call from `IB` to this instance of `BImpl`", but you can do this on a per method basis.
public interface IC {
int GetInt(string s);
}
public interface IB {
string GetString(string s);
}
public interface IA : IB, IC { }
public class BImpl : IB {
public virtual string GetString(string s) {
return $"{s}!";
}
}
public class UnitTest1 {
[Fact]
public void Partial() {
var sub = Substitute.For<IA, BImpl>();
// Method on IB / BImpl should call base implementation:
sub.When(x => x.GetString(Arg.Any<string>())).CallBase();
// Stub method on IC:
sub.GetInt("hi").Returns(42);
Assert.Equal("hi!", sub.GetString("hi"));
Assert.Equal(42, sub.GetInt("hi"));
}
}
A bit more clumsy, but probably more obvious, is using `Returns` to forward to a real instance: