public void ReleaseLocks_WhenHasLock_ShouldReleaseTheLocksInDatabase_FixBugBug_2136()
        {
            //---------------Set up test pack-------------------
            BORegistry.DataAccessor = new DataAccessorDB();
            var numberType      = "SomeType" + TestUtil.GetRandomInt();
            var numberGenerator = new NumberGeneratorPessimisticLockingStub2(numberType);

            numberGenerator.CallReleaseLocks();
            var nextNumber = numberGenerator.NextNumber();

            //---------------Assert Precondition----------------
            Assert.IsTrue(numberGenerator.IsLocked, "Should be locked");
            var numberGenerator2 = new NumberGeneratorPessimisticLockingStub2(numberType);

            Assert.IsTrue(numberGenerator2.IsLocked, "Newly loaded one from the DB should be unlocked");
            //---------------Execute Test ----------------------
            numberGenerator.CallReleaseLocks();
            //---------------Test Result -----------------------
            Assert.IsFalse(numberGenerator.IsLocked, "Should not be locked");

            // Check that newly loaded number Gen is unlocked
            var numberGenerator3 = new NumberGeneratorPessimisticLockingStub2(numberType);

            Assert.IsFalse(numberGenerator3.IsLocked, "Newly loaded number Gen from the DB should be unlocked");
        }
        public void ReleaseLocks_WhenHasLock_ShouldReleaseTheLocks_FixBugBug_2136()
        {
            //---------------Set up test pack-------------------
            BORegistry.DataAccessor = new DataAccessorDB();
            var numberType      = "SomeType" + TestUtil.GetRandomInt();
            var numberGenerator = new NumberGeneratorPessimisticLockingStub2(numberType);

            numberGenerator.CallReleaseLocks();
            numberGenerator.NextNumber();
            //---------------Assert Precondition----------------
            Assert.IsTrue(numberGenerator.IsLocked, "Should be locked");
            //---------------Execute Test ----------------------
            numberGenerator.CallReleaseLocks();
            //---------------Test Result -----------------------
            Assert.IsFalse(numberGenerator.IsLocked, "Should not be locked");
        }
 public void ReleaseLocks_WhenHasLock_ShouldReleaseTheLocks_FixBugBug_2136()
 {
     //---------------Set up test pack-------------------
     BORegistry.DataAccessor = new DataAccessorDB();
     var numberType = "SomeType" + TestUtil.GetRandomInt();  
     var numberGenerator = new NumberGeneratorPessimisticLockingStub2(numberType);
     numberGenerator.CallReleaseLocks();
     numberGenerator.NextNumber();
     //---------------Assert Precondition----------------
     Assert.IsTrue(numberGenerator.IsLocked,"Should be locked");
     //---------------Execute Test ----------------------
     numberGenerator.CallReleaseLocks();
     //---------------Test Result -----------------------
     Assert.IsFalse(numberGenerator.IsLocked, "Should not be locked");
 }
        public void ReleaseLocks_WhenHasLock_ShouldReleaseTheLocksInDatabase_FixBugBug_2136()
        {
            //---------------Set up test pack-------------------
            BORegistry.DataAccessor = new DataAccessorDB();
            var numberType = "SomeType" + TestUtil.GetRandomInt();
            var numberGenerator = new NumberGeneratorPessimisticLockingStub2(numberType);
            numberGenerator.CallReleaseLocks();
            var nextNumber = numberGenerator.NextNumber();
            //---------------Assert Precondition----------------
            Assert.IsTrue(numberGenerator.IsLocked, "Should be locked");
            var numberGenerator2 = new NumberGeneratorPessimisticLockingStub2(numberType);
            Assert.IsTrue(numberGenerator2.IsLocked, "Newly loaded one from the DB should be unlocked");
            //---------------Execute Test ----------------------
            numberGenerator.CallReleaseLocks();
            //---------------Test Result -----------------------
            Assert.IsFalse(numberGenerator.IsLocked, "Should not be locked");

            // Check that newly loaded number Gen is unlocked
            var numberGenerator3 = new NumberGeneratorPessimisticLockingStub2(numberType);
            Assert.IsFalse(numberGenerator3.IsLocked, "Newly loaded number Gen from the DB should be unlocked");
        }