【发布时间】:2011-10-21 17:20:54
【问题描述】:
想象一个这样的函数:
private static ConcurrentList<object> list = new ConcurrentList<object>();
public void Add(object x)
{
Task.Factory.StartNew(() =>
{
list.Add(x);
}
}
我不在乎 fentry 何时添加到列表中,但我需要在最后添加它(显然 ;))
我看不到在不返回任何回调处理程序或某事的情况下正确地对此类内容进行单元测试的方法。并因此添加程序不需要的逻辑
你会怎么做?
【问题讨论】:
-
你在实施什么
ConcurrentList<object>from
标签: c# unit-testing asynchronous task-parallel-library