public void ExitingSetsIsBusyToFalseAgain() { var busyState = new BusyState(); busyState.Enter(); busyState.Exit(); Assert.IsFalse(busyState.IsBusy); }
public void CanUseUsingBlock() { var busyState = new BusyState(); using (busyState.Enter()) { Assert.IsTrue(busyState.IsBusy); } Assert.IsFalse(busyState.IsBusy); }
public void DoesntGetItsKnickersInATwistWhenExitingTooManyTimes() { var busyState = new BusyState(); busyState.Exit(); busyState.Exit(); busyState.Exit(); Assert.IsFalse(busyState.IsBusy); busyState.Enter(); Assert.IsTrue(busyState.IsBusy); }
public void MustCallExitSameNumberOfTimesAsEnter() { var busyState = new BusyState(); busyState.Enter(); busyState.Enter(); busyState.Enter(); busyState.Exit(); Assert.IsTrue(busyState.IsBusy); busyState.Exit(); Assert.IsTrue(busyState.IsBusy); busyState.Exit(); Assert.IsFalse(busyState.IsBusy); }
public void RaisesPropertyChangedOnIsBusyChanged() { var changes = new Queue<string>(); var busyState = new BusyState(); busyState.PropertyChanged += (x, e) => changes.Enqueue(e.PropertyName); busyState.Enter(); Assert.AreEqual("IsBusy", changes.Dequeue()); busyState.Enter(); Assert.AreEqual(0, changes.Count); busyState.Exit(); Assert.AreEqual(0, changes.Count); busyState.Exit(); Assert.AreEqual("IsBusy", changes.Dequeue()); Assert.AreEqual(0, changes.Count); }
/// <summary> /// Initializes a new instance of the <see cref="BackgroundOperationCollection"/> class. /// </summary> /// <param name="busyState">State of the busy.</param> /// <param name="dispatcher">The dispatcher.</param> public BackgroundOperationCollection(BusyState busyState, IDispatcher dispatcher) { this.busyState = busyState; this.dispatcher = dispatcher; activeOperations.CollectionChanged += (x, y) => OnCollectionChanged(y); }
public void EnteringSetsIsBusyToTrue() { var busyState = new BusyState(); busyState.Enter(); Assert.IsTrue(busyState.IsBusy); }
public void WhenInitializedIsNotBusy() { var busyState = new BusyState(); Assert.IsFalse(busyState.IsBusy); }