-1
如何Exposte RhinoMock對象作爲屬性
我想下面的代碼片段
internal class Mocks
{
private MockRepository.GenerateMock<IFormsAuthentication> formsAuthentication;
}
,但其現在的工作對我來說任何人都知道如何使用rhinomocks
做到這一點如何Exposte RhinoMock對象作爲屬性
我想下面的代碼片段
internal class Mocks
{
private MockRepository.GenerateMock<IFormsAuthentication> formsAuthentication;
}
,但其現在的工作對我來說任何人都知道如何使用rhinomocks
做到這一點MockRepository.GenerateMock<IFormsAuthentication>()
是一種方法,而不是一種類型。
它看起來像你希望做的是這樣的:
internal class Mocks
{
private IFormsAuthentication formsAuthentication;
internal Mocks()
{
formsAuthentication = MockRepository.GenerateMock<IFormsAuthentication>();
}
}
謝謝哥們這是我一直在尋找,但現在我遇到了不同的問題 內部類嘲笑 { 私有靜態IFormsAuthentication _formsAuthentication; 公共IFormsAuthentication FormsAuthentication { 得到 { _formsAuthentication = MockRepository.GenerateMock(); return _formsAuthentication; } } –
Snehal
2010-10-13 21:48:17
你到底有什麼問題?你可能想編輯你的問題而不是在這裏評論,它會有一個更好的格式。 – Joseph 2010-10-13 23:53:58