Exemplo n.º 1
0
            public void CanReleaseLockIfLockAquired()
            {
                using (var aggregateLock = new AggregateLock(typeof(Aggregate), GuidStrategy.NewGuid()))
                {
                    aggregateLock.Aquire();
                    aggregateLock.Release();

                    Assert.False(aggregateLock.Aquired);
                }
            }
Exemplo n.º 2
0
            public void CannotReleaseLockIfLockNotAquired()
            {
                var aggregateId = GuidStrategy.NewGuid();

                using (var aggregateLock = new AggregateLock(typeof(Aggregate), aggregateId))
                {
                    var ex = Assert.Throws <InvalidOperationException>(() => aggregateLock.Release());

                    Assert.Equal(Exceptions.AggregateLockNotHeld.FormatWith(typeof(Aggregate), aggregateId), ex.Message);
                }
            }
            public void CannotReleaseLockIfLockNotAquired()
            {
                var aggregateId = GuidStrategy.NewGuid();
                using (var aggregateLock = new AggregateLock(typeof(Aggregate), aggregateId))
                {
                    var ex = Assert.Throws<InvalidOperationException>(() => aggregateLock.Release());

                    Assert.Equal(Exceptions.AggregateLockNotHeld.FormatWith(typeof(Aggregate), aggregateId), ex.Message);
                }
            }
            public void CanReleaseLockIfLockAquired()
            {
                using (var aggregateLock = new AggregateLock(typeof(Aggregate), GuidStrategy.NewGuid()))
                {
                    aggregateLock.Aquire();
                    aggregateLock.Release();

                    Assert.False(aggregateLock.Aquired);
                }
            }