public void TestClone_EmptyStack() { StaticStack <int> stack = new StaticStack <int>(); StaticStack <int> clone = (StaticStack <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() { StaticStack <int> stack = new StaticStack <int>(); int stackCount = 5; for (int i = 0; i < stackCount; i++) { stack.Push(i); } StaticStack <int> clone = (StaticStack <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()); }