public void CanReleaseLockIfLockAquired() { using (var sagaLock = new SagaLock(typeof(Saga), GuidStrategy.NewGuid())) { sagaLock.Aquire(); sagaLock.Release(); Assert.False(sagaLock.Aquired); } }
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); } }
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); } }