If I will use dynamic mock and try to use a property that is not set up, it will simply return default(null) for this property.
I need the same behaviour in Partial Mock only for one property. I need that this property return null. (property should be not virtual)
For example:
public abstract class SomeClass
{
public XmlDocument SomeProperty
{
get { return _someProperty ?? (_someProperty = SomeMethod()); }
//this getter should return null in my case and doesn't call SomeMethod
}
}
[Test]
public void SomeTest()
{
//Arrange
var obj = MockRepository.GeneratePartialMock<SomeClass>();
//Act
obj.Act(); // this method will use SomeProperty
//Assert
...
}