vendredi 26 août 2016

Unit Testing Parallel.Foreach C#

I have been using JustMock for unit testing in C#. The problem I am facing is I cannot assert the functions called inside Parallel.Foreach. However the assignments done inside can be asserted.

    Parallel.ForEach( aList,entity =>
    {
         parameter.value = 5; //Can be asserted using  Assert(5,parameter.value) in the test
         parameter.call();   //Cannot be asserted, assertion fails Mock.Assert(parameter) in the test is arranged using MustBeCalled
    })

I found the same issue in other test cases also. Is this some wrong behavior of JustMock?

Aucun commentaire:

Enregistrer un commentaire