Exemple #1
0
        public void EnsureNotEntered_throws_after_enter()
        {
            var monitor = new ThrowingMonitor();

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

            monitor.EnsureNotEntered();
            monitor.Enter();
            monitor.Exit();
            monitor.EnsureNotEntered();
        }
Exemple #3
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 EnsureNotEntered_throws_after_enter()
        {
            var monitor = new ThrowingMonitor();

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

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

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