public string ModifyClientAccount(int clientAccountId) { using (var clientAccountLock = new ClientAccountLock(clientAccountId)) { System.Threading.Thread.Sleep(10000); } return "Client Account Modification Complete"; }
public void the_client_account_should_be_locked_during_and_unlocked_after() { StateManager.ResetStateManager(); using (var lockedClientAccount = new ClientAccountLock(123)) { Assert.NotNull(lockedClientAccount); Assert.True(StateManager.IsClientAccountIDLocked(lockedClientAccount.ClientAccountId)); var newLock = new LockedClientAccount { ClientAccountId = 123, MethodCalled = "Test" }; Assert.Throws<ArgumentException>(() => StateManager.LockClientAccount(newLock)); } Assert.False(StateManager.IsClientAccountIDLocked(123)); }