public void DoesNotCauseDeathLock()
            {
                CompositeExpirationPolicy policy = new CompositeExpirationPolicy().Add(new CustomExpirationPolicy(() => true)).Add(new CustomExpirationPolicy(() => true));
                var events = new [] { new AutoResetEvent(false), new AutoResetEvent(false)};

                new Thread(() => 
                { 
                    Assert.IsFalse(policy.CanReset);
                    events[0].Set();
                }).Start();

                new Thread(() =>
                {
                    Assert.IsFalse(policy.CanReset);
                    events[1].Set();
                }).Start();

                // How specify the apartment statte to with MSTest: 
                // WaitHandle.WaitAll(events,TimeSpan.FromSeconds(10))
                events[0].WaitOne(TimeSpan.FromSeconds(10));
                events[1].WaitOne(TimeSpan.FromSeconds(10));
            }
            public void DoesNotCauseDeathLockIfPolicyCanNotBeResetAndThrowsInvalidOperationException()
            {
                var events = new[] { new AutoResetEvent(false), new AutoResetEvent(false) };
                CompositeExpirationPolicy policy = new CompositeExpirationPolicy().Add(new CustomExpirationPolicy(() => true)).Add(new CustomExpirationPolicy(() => true));

                new Thread(() =>
                    {
                        ExceptionTester.CallMethodAndExpectException<InvalidOperationException>(policy.Reset);
                        events[0].Set();
                    }).Start();

                new Thread(() =>
                    {
                        ExceptionTester.CallMethodAndExpectException<InvalidOperationException>(policy.Reset);
                        events[1].Set();
                    }).Start();

                // How specify the apartment statte to with MSTest: 
                // WaitHandle.WaitAll(events,TimeSpan.FromSeconds(10))
                events[0].WaitOne(TimeSpan.FromSeconds(10));
                events[1].WaitOne(TimeSpan.FromSeconds(10));
            }