public void PopShouldReturnTheOnlyItemAndSetCountToZeroWhenStackHasOneItems() { WorkItemWaiterEntryStack stack = new WorkItemWaiterEntryStack(); IWorkItemWaiterEntry entry = Substitute.For<IWorkItemWaiterEntry>(); stack.Push(entry); Assert.AreEqual(entry, stack.Pop()); Assert.AreEqual(0, stack.Count); Assert.AreEqual(null, stack.Pop()); Assert.AreEqual(0, stack.Count); }
public void PopShouldReturnTheOnlyItemAndSetCountToZeroWhenStackHasOneItems() { WorkItemWaiterEntryStack stack = new WorkItemWaiterEntryStack(); IWorkItemWaiterEntry entry = Substitute.For <IWorkItemWaiterEntry>(); stack.Push(entry); Assert.AreEqual(entry, stack.Pop()); Assert.AreEqual(0, stack.Count); Assert.AreEqual(null, stack.Pop()); Assert.AreEqual(0, stack.Count); }
public void PopShouldReturnLastAddedItemAndDecrementCountWhenStackHasMoreThanOneItems() { WorkItemWaiterEntryStack stack = new WorkItemWaiterEntryStack(); IWorkItemWaiterEntry firstEntry = Substitute.For<IWorkItemWaiterEntry>(); IWorkItemWaiterEntry lastEntry = Substitute.For<IWorkItemWaiterEntry>(); stack.Push(firstEntry); stack.Push(lastEntry); Assert.AreEqual(2, stack.Count); Assert.AreEqual(lastEntry, stack.Pop()); Assert.AreEqual(1, stack.Count); Assert.AreEqual(firstEntry, stack.Pop()); Assert.AreEqual(0, stack.Count); Assert.AreEqual(null, stack.Pop()); Assert.AreEqual(0, stack.Count); }
public void PopShouldReturnLastAddedItemAndDecrementCountWhenStackHasMoreThanOneItems() { WorkItemWaiterEntryStack stack = new WorkItemWaiterEntryStack(); IWorkItemWaiterEntry firstEntry = Substitute.For <IWorkItemWaiterEntry>(); IWorkItemWaiterEntry lastEntry = Substitute.For <IWorkItemWaiterEntry>(); stack.Push(firstEntry); stack.Push(lastEntry); Assert.AreEqual(2, stack.Count); Assert.AreEqual(lastEntry, stack.Pop()); Assert.AreEqual(1, stack.Count); Assert.AreEqual(firstEntry, stack.Pop()); Assert.AreEqual(0, stack.Count); Assert.AreEqual(null, stack.Pop()); Assert.AreEqual(0, stack.Count); }
public void PopShouldReturnNullWhenStackIsEmpty() { WorkItemWaiterEntryStack stack = new WorkItemWaiterEntryStack(); Assert.AreEqual(null, stack.Pop()); }