You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have concrete class which inherits an abstract class and overrides some if its members, and then in my test scenario, I want proxy specific ones of those for the test. Like this:
public class Base
{
public abstract void F();
public abstract void G();
}
public class MockBase : Base
{
public override int F() { /* stuff */ }
public override void G() { /* stuff */ }
}
public class TestClass
{
[Fact]
public void DoTest()
{
var mock = new Mock<MockBase>() { CallBase = true };
mock.Setup(mb => mb.F()).Returns(7); // <== this shouldn't fail
// rest of test
}
}
Overridden methods are themselves virtual unless marked with sealed.
The text was updated successfully, but these errors were encountered:
I have concrete class which inherits an abstract class and overrides some if its members, and then in my test scenario, I want proxy specific ones of those for the test. Like this:
Overridden methods are themselves virtual unless marked with
sealed
.The text was updated successfully, but these errors were encountered: