public void PopTest() { StackClass stack = new StackClass(); stack.Pop(56); stack.Push(4); stack.Pop(4); Assert.IsTrue(stack.IsEmpty()); stack.Push(4); stack.Pop(48); }
// [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 void PushOne() { StackClass myStack = new StackClass(); myStack.Push("my first element"); Assert.IsFalse(myStack.IsEmpty, "IsEmpty muss falsch sein"); }
private static void GetStack(StackClass <int> stackClass) { string input = string.Empty; while ((input = Console.ReadLine()) != "END") { string[] commandOfArgs = input.Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); string command = commandOfArgs[0]; try { switch (command) { case "Pop": stackClass.Pop(); break; case "Push": int[] elements = commandOfArgs .Skip(1) .Select(int.Parse) .ToArray(); stackClass.Push(elements); break; default: break; } } catch (ArgumentException ArgEx) { Console.WriteLine(ArgEx.Message); } } }
public void PopOne() { StackClass myStack = new StackClass(); myStack.Push("my first element"); myStack.Pop(); Assert.IsTrue(myStack.IsEmpty); }
public void CanPushMultipleNodes() { 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); Assert.Equal(22, stack.Top.Value); }
public void CanPopOffStack() { 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); stack.Pop(); Assert.Equal(15, stack.Top.Value); }
public void CanPushOntoStack() { StackClass <int> stack = new StackClass <int>(); Node <int> node = new Node <int>(); node.Value = 5; stack.Push(node.Value); Assert.Equal(5, stack.Top.Value); }
public void PushPopContentEqual() { int WasIchHabe = 1234; myStack.Push(WasIchHabe); int WasIchBekomme = (int)myStack.Pop(); Assert.AreEqual(WasIchHabe, WasIchBekomme); }
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); }
static void Stack() { var _stack = new StackClass(); int ini = 1; int max = 5; for (int i = ini; i <= max; i++) { _stack.Push(i); } _stack.Clear(); for (int i = ini; i <= max; i++) { Console.WriteLine(_stack.Pop()); } }
public void Push_Integer() { // Arrange int[] startingStack = { 1, 2, 3, 4 }; int theInteger = 111; int[] expected = { 1, 2, 3, 4, 111 }; StackClass sc = new StackClass(startingStack); // Act sc.Push(theInteger); // Assert int[] actual = sc.Stack; for (int i = 0; i < expected.Length; i++) { Assert.AreEqual(expected[i], actual[i], "The stack is not pushed correctly"); } }
public void PushTest() { StackClass stack = new StackClass(); stack.Push(7); Assert.IsFalse(stack.IsEmpty()); }