我使用最小起订量和我的问题Tfs属性(ItemSet),如何使用最小起订量,因为ItemSet只能得到...
public sealed class ItemSet
{
public Item[] Items { get; }
public string Pattern { get; }
public string QueryPath { get; }
public override string ToString();
}
样本,
ItemSet allItems = versionControl.GetItems(@"$/");
如何编写单元测试和模拟?
最佳答案
您不能使用 Moq 来模拟密封类。
你可以写一系列proxies它包装了密封的 TFS 类,其中每个代理都基于一个抽象,您可以使用它来编写测试。
通常(特别是对于像集合这样的对象),可以使用密封类并使用 test builder类或类似的类,以消除实例化所有依赖项并将所有内容插入在一起的痛苦。在您的情况下,您需要创建所有项目、模式和查询路径(以及每个项目的所有依赖项,如果有的话),并创建一个具有测试安全值的真实项目集。
关于unit-testing - 如何在 TFS 中使用起订量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10614090/