Ejemplo n.º 1
0
 public void IsEmpty()
 {
     ListStack myList = new ListStack();
     myList.Push(123);
     myList.Pop();
     Assert.AreEqual(true, myList.IsEmpty());
     Assert.AreEqual(true, myList.IsEmpty());
 }
Ejemplo n.º 2
0
 public void Pop2()
 {
     ListStack myList = new ListStack();
     myList.Push(123);
     myList.Push(321);
     myList.Push(132);
     Assert.AreEqual(132, myList.Pop());
     Assert.AreEqual(321, myList.Pop());
     Assert.AreEqual(123, myList.Pop());
 }
Ejemplo n.º 3
0
 public void LastTest()
 {
     ListStack myList = new ListStack();
     myList.Push(0);
     myList.Push(1);
     Assert.AreEqual(1, myList.Pop());
     myList.Push(2);
     myList.Push(3);
     myList.Push(2);
     Assert.AreEqual(2, myList.Pop());
     Assert.AreEqual(3, myList.Pop());
     Assert.AreEqual(2, myList.Pop());
     Assert.AreEqual(0, myList.Pop());
     Assert.AreEqual(true, myList.IsEmpty());
 }
Ejemplo n.º 4
0
        /// <summary>
        /// The entry point of the program, where the program control starts and ends.
        /// </summary>
        /// <param name="args">The command-line arguments.</param>
        public static void Main(string[] args)
        {
            ArrayStack myStack = new ArrayStack();
            StackCalculator myCalculator = new StackCalculator(myStack);
            myCalculator.Push(3);
            myCalculator.Push(2);
            myCalculator.Push(1);
            myCalculator.Add();
            myCalculator.Multiply();
            Console.WriteLine(myCalculator.Result());

            ListStack myStack2 = new ListStack();
            StackCalculator myCalculator2 = new StackCalculator(myStack2);
            myCalculator2.Push(1);
            myCalculator2.Push(2);
            myCalculator2.Push(3);
            myCalculator2.Add();
            myCalculator2.Multiply();
            Console.WriteLine(myCalculator2.Result());
        }
Ejemplo n.º 5
0
 public void Push()
 {
     ListStack myList = new ListStack();
     myList.Push(8);
 }
Ejemplo n.º 6
0
 public void Pop_UpperBorder()
 {
     ListStack myList = new ListStack();
     myList.Push(int.MaxValue);
     Assert.AreEqual(int.MaxValue, myList.Pop());
 }
Ejemplo n.º 7
0
 public void Pop()
 {
     ListStack myList = new ListStack();
     myList.Push(123456);
     Assert.AreEqual(123456, myList.Pop());
 }
Ejemplo n.º 8
0
 public void IsNotEmpty()
 {
     ListStack myList = new ListStack();
     myList.Push(123);
     Assert.AreEqual(false, myList.IsEmpty());
 }
Ejemplo n.º 9
0
 public void InitialState()
 {
     ListStack myList = new ListStack();
 }
Ejemplo n.º 10
0
 public void Top()
 {
     ListStack myList = new ListStack();
     myList.Push(12);
     Assert.AreEqual(12, myList.Top());
 }
Ejemplo n.º 11
0
 public void Push_Borders()
 {
     ListStack myList = new ListStack();
     myList.Push(int.MinValue);
     myList.Push(int.MaxValue);
 }