jeudi 29 octobre 2015

In .NET what is a way to test an Async Lock, proving that reentrancy is prevented?

I have a method like this:

public async Task ConnectAsync()
{
    using (await _connectMutex.LockAsync())
    {
        ...
    }
}

...which prevents reentrancy. What is a simple way to unit test this method, to prove that reentrancy is prohibited?

Aucun commentaire:

Enregistrer un commentaire