在 VSTO ContactItem 上使用 Moq 时,我收到以下错误:
variable 'x' of type 'Microsoft.Office.Interop.Outlook.ContactItem' referenced from scope '', but it is not defined
代码如下:
public class ContactItemTests
{
private Mock<ContactItem> _contactItemMock;
[SetUp]
public void Init()
{
_contactItemMock = new Mock<ContactItem>();
}
[Test]
public void MyTest()
{
var firstName= _contactItemMock.Setup(x => x.FirstName).Returns("Don");
var userProperty = _contactItemMock.Setup(x => x.UserProperties.Find("Test",null)).Returns(()=>null);
Assert.IsTrue(userProperty == null);
}
}
我的问题是:
为什么 VS 2017 找不到 UserProperties 属性?
阿波罗的战车
相关分类