我正在编写一些单元测试,我想模拟用户hmGuid
。为此,我执行以下操作。
string userGuidString = "b3830ce8-09aa-41ac-b759-d2af4388c706";
Guid hmGuid = Guid.NewGuid();
Isolate.WhenCalled(() => hmGuid.ToString()).WillReturn(userGuidString);
然而,当我这样做时,我收到以下错误
No method calls found in recording block. Please check:
Are you trying to fake a field instead of a property? try to set field
对此的任何帮助将不胜感激。 ToString()
非常标准,我已经能够在
答案 0 :(得分:2)