static void StackV2() { CustomStackV2 cs = new CustomStackV2(); for (int i = 0; i < 20; i++) { cs.Push(i * 10); } var tmp = cs.GetItem(); for (int i = 0; i < tmp.Length; i++) { Console.WriteLine("Item -> " + tmp[i]); } cs.Pop(); cs.Pop(); Console.WriteLine("After Pop :"); tmp = cs.GetItem(); for (int i = 0; i < tmp.Length; i++) { Console.WriteLine("Item -> " + tmp[i]); } cs.Push(40); Console.WriteLine("After push 40 : "); tmp = cs.GetItem(); for (int i = 0; i < tmp.Length; i++) { Console.WriteLine("Item -> " + tmp[i]); } }
public void StackV2Test() { CustomStackV2 cs = new CustomStackV2(); for (int i = 0; i < 20; i++) { cs.Push(i * 10); } Assert.AreEqual(20, cs.Count); cs.Pop(); Assert.AreEqual(19, cs.Count); }