static void Main() { StackOfInt pilica = new StackOfInt(); pilica.Push(1); pilica.Push(2); pilica.Push(3); pilica.Push(4); pilica.Push(5); Console.WriteLine("Cantidad Ini. : " + pilica.Count); Console.WriteLine(pilica.Pop()); Console.WriteLine(pilica.Pop()); Console.WriteLine(pilica.Pop()); Console.WriteLine(pilica.Pop()); Console.WriteLine(pilica.Pop()); Console.WriteLine("Cantidad Fin : " + pilica.Count); Console.WriteLine(); int[] enteros = { 1, 2, 3, 4, 5 }; StackOfInt pilica2 = new StackOfInt(enteros); Console.WriteLine("Cantidad Ini. : " + pilica2.Count); Console.WriteLine(pilica2.Pop()); Console.WriteLine(pilica2.Pop()); Console.WriteLine(pilica2.Pop()); Console.WriteLine(pilica2.Pop()); Console.WriteLine(pilica2.Pop()); Console.WriteLine("Cantidad Fin : " + pilica2.Count); }
public void Testpop() { StackOfInt SOI = new StackOfInt(); double expResult = 2; SOI.Push(expResult); SOI.Push(3); double expResult3 = SOI.Pop(); double result = SOI.StackInt.Peek(); Assert.AreEqual(expResult, result); Assert.AreEqual(expResult3, 3); double expResult2 = 3; SOI.Push(expResult2); SOI.Push(2); double expResult4 = SOI.Pop(); double result2 = SOI.StackInt.Peek(); Assert.AreEqual(expResult2, result2); Assert.AreEqual(expResult4, 2); }