Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        public void EnsureNotEntered_throws_after_enter()
        {
            var monitor = new ThrowingMonitor();

            monitor.Enter();
            Assert.Equal(Strings.ConcurrentMethodInvocation,
                         Assert.Throws <DbConcurrencyException>(() =>
                                                                monitor.EnsureNotEntered()).Message);
        }
Ejemplo n.º 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);
        }