コード例 #1
0
            public void CanReleaseLockIfLockAquired()
            {
                using (var sagaLock = new SagaLock(typeof(Saga), GuidStrategy.NewGuid()))
                {
                    sagaLock.Aquire();
                    sagaLock.Release();

                    Assert.False(sagaLock.Aquired);
                }
            }
コード例 #2
0
            public void CannotReleaseLockIfLockNotAquired()
            {
                var sagaId = GuidStrategy.NewGuid();

                using (var sagaLock = new SagaLock(typeof(Saga), sagaId))
                {
                    var ex = Assert.Throws <InvalidOperationException>(() => sagaLock.Release());

                    Assert.Equal(Exceptions.SagaLockNotHeld.FormatWith(typeof(Saga), sagaId), ex.Message);
                }
            }
コード例 #3
0
            public void CannotReleaseLockIfLockNotAquired()
            {
                var sagaId = GuidStrategy.NewGuid();
                using (var sagaLock = new SagaLock(typeof(Saga), sagaId))
                {
                    var ex = Assert.Throws<InvalidOperationException>(() => sagaLock.Release());

                    Assert.Equal(Exceptions.SagaLockNotHeld.FormatWith(typeof(Saga), sagaId), ex.Message);
                }
            }
コード例 #4
0
            public void CanReleaseLockIfLockAquired()
            {
                using (var sagaLock = new SagaLock(typeof(Saga), GuidStrategy.NewGuid()))
                {
                    sagaLock.Aquire();
                    sagaLock.Release();

                    Assert.False(sagaLock.Aquired);
                }
            }