【发布时间】:2011-08-18 16:02:56
【问题描述】:
我在 Visual Studio 2010 中有一个测试项目。我有一个 TestMethod。在这里面,我想遍历一个列表并测试每一个。所以,我有 1 个测试并且想要断言 N 次(列表中的每个项目一次)。
但是,如果失败,我不想停下来。我想继续,然后一起报告所有失败。
例子:
[TestMethod]
public void Test()
{
foreach (item in list)
{
// if fail, continue on with the rest
Assert(if fail, add to output list);
}
output_failures_all_at_once;
}
【问题讨论】:
标签: c# visual-studio-2010 unit-testing