我只是在做一个起订量单元测试,如下所示。
由于设置无效,测试失败。
谁能告诉我为什么设置错误?
[TestInitialize]
public void SetupMockRepository()
{
_mockPropertySearchRepository = new Mock<IPropertySearchRepository>(MockBehavior.Strict);
var linkIdHash = new PropertyIdLinkIdHash() { CountryCode = "AU", LinkIdHash = "4567890", PropertyId = "5234526" };
//Get details
_mockPropertySearchRepository.Setup(mq => mq.GetPropertyDetails(It.Is<PropertyIdLinkIdHash>(p => p == linkIdHash))).Returns(new Roots());
this.MockPropertySearchRepository = _mockPropertySearchRepository.Object;
}
/// <summary>
/// Testing object pattern
/// </summary>
[TestMethod]
public void Can_Get_Property_Details_AU()
{
var linkIdHash = new PropertyIdLinkIdHash() { CountryCode = "AU", LinkIdHash = "4567890", PropertyId = "5234526" };
var result = MockContext.GetPropertyDetails(linkIdHash);
Assert.IsNotNull(result);
}
}
谢谢