Beispiel #1
0
        public void Enter_throws_when_called_twice()
        {
            var monitor = new ThrowingMonitor();

            monitor.Enter();
            Assert.Equal(Strings.ConcurrentMethodInvocation,
                         Assert.Throws <DbConcurrencyException>(() =>
                                                                monitor.Enter()).Message);
        }
        public void Enter_throws_when_called_twice()
        {
            var monitor = new ThrowingMonitor();

            monitor.Enter();
            Assert.Equal(Strings.ConcurrentMethodInvocation,
                Assert.Throws<NotSupportedException>(() =>
            monitor.Enter()).Message);
        }
Beispiel #3
0
        public void EnsureNotEntered_throws_after_enter()
        {
            var monitor = new ThrowingMonitor();

            monitor.Enter();
            Assert.Equal(Strings.ConcurrentMethodInvocation,
                         Assert.Throws <DbConcurrencyException>(() =>
                                                                monitor.EnsureNotEntered()).Message);
        }
Beispiel #4
0
        public void EnsureNotEntered_doesnt_throw_before_enter_or_after_Exit()
        {
            var monitor = new ThrowingMonitor();

            monitor.EnsureNotEntered();
            monitor.Enter();
            monitor.Exit();
            monitor.EnsureNotEntered();
        }
        public void EnsureNotEntered_doesnt_throw_before_enter_or_after_Exit()
        {
            var monitor = new ThrowingMonitor();

            monitor.EnsureNotEntered();
            monitor.Enter();
            monitor.Exit();
            monitor.EnsureNotEntered();
        }
        public void EnsureNotEntered_throws_after_enter()
        {
            var monitor = new ThrowingMonitor();

            monitor.Enter();
            Assert.Equal(Strings.ConcurrentMethodInvocation,
                Assert.Throws<DbConcurrencyException>(() =>
            monitor.EnsureNotEntered()).Message);
        }