public void UncheckedLayeredStack() { // Arrange var stack = new CheckedLayeredStack <string>(); // Act stack.Lock(); // Assert Assert.True(stack.IsEmpty()); Assert.Equal(1, stack.LockCount()); // Act stack.Unlock(); // Assert Assert.True(stack.IsEmpty()); Assert.Equal(0, stack.LockCount()); // Assert Assert.Throws <NutmegException>(() => stack.Unlock()); }
public void CanUnlock_Unlock_Test() { // Arrange var stack = new CheckedLayeredStack <string>(); stack.Push("p"); stack.Push("q"); stack.Lock(); // Act stack.Unlock(); // Assert Assert.Equal(0, stack.LockCount()); Assert.Equal(2, stack.Size()); }