8
我一直在使用JustMock进行C#中的单元测试。 我面临的问题是我无法断言在Parallel.Foreach
内调用的函数。然而,内部完成的任务可以被断言。单元测试Parallel.Foreach C#
Parallel.ForEach(aList, entity =>
{
//Can be asserted using Assert(5,parameter.value) in the test
parameter.value = 5;
//Cannot be asserted, assertion fails Mock.Assert(parameter) in the test
//is arranged using MustBeCalled
parameter.call();
})
我在其他测试用例中也发现了同样的问题。这是JustMock的一些错误行为吗?
对Telerik Helpdesk问这个问题不是更有意义吗? – lokusking
你做了什么其他测试? – Neil
尝试删除并行,只是做一个正常的foreach。 –