[Test]
public void Something()
{
var myObjectFake = new Mock<MyObject>()
.Setup(x => x.MyMethod())
.Returns("Hello")
.Verify(x => x.MyMethod(), Times.Once());
var myObject = myObjectFake.Object;
}
private AutoMoqer mocker;
[SetUp]
public void Setup()
{
mocker = new AutoMoqer(); // init a new instance on each test run
}
[Test]
public void Something()
{
mocker.GetMock<MyObject>()
.Setup(x => x.MyMethod())
.Returns("Hello")
.Verify(x => x.MyMethod(), Times.Once());
var myObjectFake = mocker.Resolve<MyObject>();
}