我FirstName
在抽象类上有一个虚拟属性Foo
. 我需要测试虚拟财产的行为。执行此测试时,该方法永远不会触发(因此无论方法体中有什么,测试总是失败)。我怎样才能使这种方法成为我正在测试的系统?我该如何测试这种方法?
[Subject(typeof(Foo))]
public class When_whatever
{
Establish context = () =>
{
_fooSut = _mockRepository.PartialMock<Foo>(argumentOne, argumentTwo);
};
Because of = () => _result = _fooSut.FirstName;
It should_return_not_null = () => _result.ShouldNotBeNull();
private static string _result;
private static Foo _fooSut;
}
我正在使用 Rhino Mocks 3.5 和 mspec。