コード例 #1
0
        public void AssertRun_Given_ClassWithDictionaryAsyncDeadlock_Should_ThrowException()
        {
            var instance = new ClassWithAsyncDeadlock();

            Assert.Throws <AggregateException>(() => ConcurrencyChecker.AssertAsyncDeadlocksOnly(async() => await instance.DictionaryNotThreadSafeShouldLock(), 500));
        }
コード例 #2
0
        public void AssertRun_Given_ClassWithDictionaryAsyncDeadlock_Should_ThrowException()
        {
            var instance = new ClassWithAsyncDeadlock();
            var finder   = new ConcurrencyChecker(instance, null, 500);

            var error = Assert.Throws <ConcurrencyException>(() => finder.Assert(5, async() => await instance.DictionaryNotThreadSafeShouldLock()));

            Assert.AreEqual("Possible deadlock detected. Make sure that you do not use .Wait() or .Result on async methods.", error.Message);
        }