public void CanAcquire_can_always_acquire_something_not_yet_acquired() { // Arrange var name = Guid.NewGuid().ToString(); // Act var result = MutexManager.CanAcquire(name); // Assert result.ShouldBeTrue(); }
public void CanAcquire_returns_false_for_a_lock_already_acquired() { // Arrange var name = Guid.NewGuid().ToString(); // Act using (var result = MutexManager.Acquire(name)) { MutexManager.CanAcquire(name).ShouldBeFalse(); } // Assert MutexManager.Mutexes.Count.ShouldBe(0); }