public void Enter_WhenCompleted_LockIsAcquired() { _mutex.Enter(Key); using (var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(3))) { Assert.Throws <OperationCanceledException>( () => _mutex.EnterAsync(Key, cancellationTokenSource.Token).GetAwaiter().GetResult()); } _mutex.Exit(Key); }