static void Main(string[] args) { //StackCalculator<int> stackCal = new StackCalculator<int>(); //stackCal.push(1); //stackCal.push(1); //string result2 = stackCal.Add(); //Console.WriteLine(stackCal.getStackString()); string consoleCommandString = ""; int consoleCommandIntArgument; StackCalculator <int> stackCal = new StackCalculator <int>(); while (consoleCommandString != "exit") { consoleCommandString = Console.ReadLine(); switch (extractCommandFromString(consoleCommandString)) { case "push": consoleCommandIntArgument = extractNumericFromString(consoleCommandString); Console.WriteLine(stackCal.Push(consoleCommandIntArgument)); break; case "pop": Console.WriteLine(stackCal.Pop()); break; case "add": Console.WriteLine(stackCal.Add()); break; case "sub": Console.WriteLine(stackCal.Sub()); break; case "help": Console.WriteLine("Available commands: push <value>; pop; add; sub;"); break; default: Console.WriteLine("No such command, Type help for available commands"); break; } } }
public void pushTest_MaxCapacity() { //Arrange StackCalculator <int> testObject = new StackCalculator <int>(); //Act testObject.Push(1); testObject.Push(2); testObject.Push(3); testObject.Push(4); testObject.Push(5); testObject.Push(6); }
public int AdditionShouldWorkCorrect(int value1, int value2) { stackCalculator.Push(value1); stackCalculator.Push(value2); stackCalculator.Add(); return(stackCalculator.Pop()); }