The code example fails and there is no possibility to use default interface implementation in a mock.
void Main()
{
var m = new Mock<IFoo>(MockBehavior.Strict)
{
CallBase = true
};
m.SetupGet(x => x.Bar).Returns(5);
// UserQuery.IFoo.Baz invocation failed with mock behavior Strict.
// All invocations on the mock must have a corresponding setup.
Console.WriteLine(m.Object.Baz);
}
public interface IFoo {
int Bar { get; }
int Baz => Bar + 1;
}
The code example fails and there is no possibility to use default interface implementation in a mock.