public void Obtaining_Multiple_Tickets_Should_Make_BusyWatcher_Busy() { var busyWatcher = new BusyWatcher(); var dummy1 = busyWatcher.GetTicket(); var dummy2 = busyWatcher.GetTicket(); busyWatcher.IsBusy.ShouldBeTrue(); }
public void Obtaining_Multiple_Tickets_Should_Not_Make_BusyWatcher_Busy_After_Disposal() { var busyWatcher = new BusyWatcher(); using (var dummy1 = busyWatcher.GetTicket()) { } using (var dummy2 = busyWatcher.GetTicket()) { } busyWatcher.IsBusy.ShouldBeFalse(); }
public void Obtaining_A_Ticket_Should_Make_BusyWatcher_Busy() { var busyWatcher = new BusyWatcher(); var dummy = busyWatcher.GetTicket(); busyWatcher.IsBusy.ShouldBeTrue(); }
public void ShouldBeBusyInsideScope() { var busyWatcher = new BusyWatcher(); using (busyWatcher.GetTicket()) { Assert.IsTrue(busyWatcher.IsBusy); } Assert.IsFalse(busyWatcher.IsBusy); }
public void Handle(CustomerChangedMessage message) { Orders.Clear(); if (message.Customer != null && !string.IsNullOrEmpty(message.Customer.CustomerID)) { var ticket = BusyWatcher.GetTicket(); Task.Factory.StartNew(() => Orders.AddRange(_repository.GetOrdersFromCustomer(message.Customer.CustomerID))).ContinueWith((x) => ticket.Dispose()); OrderDetails = string.Format("Order Details for customer {0}", message.Customer.ContactName); } }
public void ShouldBeBusyInsideScope() { var busyWatcher = new BusyWatcher(); using (busyWatcher.GetTicket()) { Assert.IsTrue(busyWatcher.IsBusy); } Assert.IsFalse(busyWatcher.IsBusy); }
public void ShouldNotifyOfPropertyChanged() { int propertyChangedCount = 0; var busyWatcher = new BusyWatcher(); busyWatcher.PropertyChanged += (sender, args) => propertyChangedCount++; using (busyWatcher.GetTicket()) { Assert.IsTrue(propertyChangedCount == 1); } Assert.IsTrue(propertyChangedCount == 2); }
public void ShouldNotifyOfPropertyChanged() { int propertyChangedCount = 0; var busyWatcher = new BusyWatcher(); busyWatcher.PropertyChanged += (sender, args) => propertyChangedCount++; using (busyWatcher.GetTicket()) { Assert.IsTrue(propertyChangedCount == 1); } Assert.IsTrue(propertyChangedCount == 2); }
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 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); }