public async Task SuccessfulSetTests(IWorkerInfo worker, IWorkerInfo current)
        {
            var activityId = Guid.NewGuid().ToString();
            var tableLock  = new MockWorkerTableLock();

            // Test
            using (var scaleManager = new MockScaleManager(MockBehavior.Strict))
            {
                // Setup
                scaleManager.MockWorkerTable.Setup(t => t.AcquireLock())
                .Returns(() => tableLock.AcquireLock());
                scaleManager.MockWorkerTable.Setup(t => t.GetManager())
                .Returns(Task.FromResult(current));
                scaleManager.MockWorkerTable.Setup(t => t.SetManager(worker))
                .Returns(Task.CompletedTask);
                scaleManager.MockScaleTracer.Setup(t => t.TraceInformation(activityId, worker, It.Is <string>(c => c.Contains("Acquire table lock"))));
                scaleManager.MockScaleTracer.Setup(t => t.TraceInformation(activityId, worker, It.Is <string>(c => c.Contains("Release table lock"))));
                scaleManager.MockScaleTracer.Setup(t => t.TraceInformation(activityId, worker, It.Is <string>(c => c.Contains("is set to be a manager"))));

                // test
                var newManager = await scaleManager.MockSetManager(activityId, worker, current);

                // assert
                scaleManager.VerifyAll();
                Assert.True(ScaleUtils.Equals(newManager, worker));
                Assert.False(ScaleUtils.Equals(newManager, current));
            }
        }
 public virtual async Task <ILockHandle> AcquireLock()
 {
     return(await _lock.AcquireLock());
 }