Given this code:
[ContractClass(typeof(DogContract))]
public interface IDog {
void Eat(object obj);
}
[ContractClassFor(typeof(IDog))]
internal abstract DogContract : IDog {
public void Eat(object obj) {
Contract.Requires<ArgumentNullException>(obj != null);
}
}
var dogMock = new Mock<IDog>();
dogMock.Object.Eat(null); // Throws ArgumentNullException
It seems like the rewriter is somehow putting its behavior into the mocked object, which I didn't really expect. I don't think its a real problem, just unexpected. Anyone know how this is happening?