public static void Main(string[] args) { //Array.Do(); //SingleLinkedList.Do(); //DoubleLinkedList.Do(); StackProgram.Do(); //QueueProgram.Do(); }
public void Stack_With_No_Push() { // Perform no operation on the stack and verify that the stack is empty bool expected = true; bool actual = StackProgram.IsStackEmpty(myStack); // Assert that there are on elements in the stack Assert.AreEqual(expected, actual, "Stack is empty "); }
public void Stack_With_Valid_Pushes() { // Perform three push operations on the stack to arrange the test StackProgram.StackPush(10, myStack); StackProgram.StackPush(20, myStack); StackProgram.StackPush(30, myStack); int expected = 3; int actual = StackProgram.StackCount(myStack); // Assert that there are three elements in the stack Assert.AreEqual(expected, actual, "Number of items pushed to stack"); }
public void Stack_Peek_Give_Top_Item_No_Change_to_Stack() { // Perform three push operations on the stack to arrange the test StackProgram.StackPush(10, myStack); StackProgram.StackPush(20, myStack); StackProgram.StackPush(30, myStack); object expected = 30; object actual = StackProgram.StackPeek(myStack); int expected_count = 3; int actual_count = StackProgram.StackCount(myStack); // Verify that there are all three elements in the stack after Peek operation Assert.AreEqual(expected, actual, "Number of items pushed to stack is 3"); Assert.AreEqual(expected_count, actual_count, "Number of items after a Pop"); }
public void Stack_Pops_Remove_Last_Push() { // Perform three push operations on the stack to arrange the test StackProgram.StackPush(10, myStack); StackProgram.StackPush(20, myStack); StackProgram.StackPush(30, myStack); object expected = 30; int expected_count = 2; object actual = StackProgram.StackPop(myStack); int actual_count = StackProgram.StackCount(myStack); // Verify that there are two element in the stack after Pop operation Assert.AreEqual(expected, actual, "Number of items pushed to stack"); Assert.AreEqual(expected_count, actual_count, "Number of items after a Pop"); }
public static void StartProgram() { while (true) { StandardMessages.MainMenu(); // A static method from the standard messages class and it returns a menu of options var option = Console.ReadLine(); // stores the option value of the user Console.WriteLine(); if (option == "1") { var size = StandardMessages.Size(); // returns the size inputed by the user StackProgram stack = new StackProgram(size); // Creates an instance of the stackProgram class while (true) // A continuous loop for the stack program class { stack.Run(); // Runs the RUN Method in the stack program class } } if (option == "2") { var size = StandardMessages.Size(); // returns the size inputed by the user QueueProgram queue = new QueueProgram(size); // Creates an object of the QueueProgram class while (true) // A continuous loop for the queue program class { { queue.Run(); // Runs the RUN Method in the queue Program class } } } if (option == "3") { LinkedListProgram linkedList = new LinkedListProgram(); // Created an instance of the LinkedListProgram class while (true) // A continuous loop for the linkedList program class { { linkedList.Run(); // Runs the RUN Method in the linkedListProgram class } } } } }