我一直在使用 JustMock 在 C# 中进行单元测试。我面临的问题是我无法断言内部调用的函数Parallel.Foreach
。但是,可以断言内部完成的分配。
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 的一些错误行为吗?