public void ShouldIncrementDecrementBusyCounter() { var busyWatcher = new BusyWatcher(); busyWatcher.AddWatch(); Assert.IsTrue(busyWatcher.IsBusy); busyWatcher.RemoveWatch(); Assert.IsFalse(busyWatcher.IsBusy); }
public void BusyWatcher_Should_Throw_When_RemoveWatch_Called_Without_AddWatch() { var busyWatcher = new BusyWatcher(); Should.Throw <InvalidOperationException>(() => { busyWatcher.RemoveWatch(); }); }
public void ShoultThrowInvalidOperationException() { var expectedExceptionThrown = false; try { var busyWatcher = new BusyWatcher(); busyWatcher.RemoveWatch(); } catch (InvalidOperationException) { expectedExceptionThrown = true; } Assert.IsTrue(expectedExceptionThrown); }
public void ShouldNestBusyState() { var busyWatcher = new BusyWatcher(); busyWatcher.AddWatch(); Assert.IsTrue(busyWatcher.IsBusy); using (busyWatcher.GetTicket()) { Assert.IsTrue(busyWatcher.IsBusy); } Assert.IsTrue(busyWatcher.IsBusy); busyWatcher.RemoveWatch(); Assert.IsFalse(busyWatcher.IsBusy); }
public void BusyWatcher_RemoveWatch_Should_Throw_If_Not_Ticket_Present() { var busyWatcher = new BusyWatcher(); Should.Throw <InvalidOperationException>(() => busyWatcher.RemoveWatch()); }