// [Fact] public void CanPeek() { StackClass <int> stack = new StackClass <int>(); Node <int> node = new Node <int>(); node.Value = 5; stack.Push(node.Value); Node <int> node2 = new Node <int>(); node.Value = 15; stack.Push(node.Value); var output = stack.Peek(); }
public static void RunPushMethod() { StackClass <int> stack = new StackClass <int>(); Console.WriteLine("Choose a number to push to stack"); int input1 = Convert.ToInt32(Console.ReadLine()); stack.Push(input1); Console.WriteLine(stack.Peek()); }
public void CanEmptyStack() { StackClass <int> stack = new StackClass <int>(); Node <int> node = new Node <int>(); node.Value = 5; stack.Push(node.Value); Node <int> node2 = new Node <int>(); node.Value = 15; stack.Push(node.Value); Node <int> node3 = new Node <int>(); node.Value = 22; stack.Push(node.Value); while (node.Next != null) { stack.Pop(); } stack.Pop(); var result = stack.Peek(); Assert.Null(result); }