public void TestClone_EmptyStack() { CustomStack <int> stack = new CustomStack <int>(); CustomStack <int> clone = (CustomStack <int>)stack.Clone(); int count = 5; for (int i = 0; i < count; i++) { stack.Push(i); } Assert.AreEqual(5, stack.Count); Assert.AreEqual(0, clone.Count); Assert.AreEqual(string.Empty, clone.ToString()); }
public void TestClone_NonEmptyStack() { CustomStack <int> stack = new CustomStack <int>(); int stackCount = 5; for (int i = 0; i < stackCount; i++) { stack.Push(i); } CustomStack <int> clone = (CustomStack <int>)stack.Clone(); for (int i = 0; i < stackCount; i++) { stack.Pop(); } Assert.AreEqual(0, stack.Count); Assert.AreEqual(5, clone.Count); Assert.AreEqual("43210", clone.ToString()); }