public void Constructor() { var stack = new CircularStack <int>(); for (int i = 0; i < 4; i++) { stack.Add(i); } Assert.AreEqual(stack.Count, 4); }
public void Preprend() { var stack = new CircularStack <int>(); for (int i = 0; i < 4; i++) { stack.Add(i); } stack[1].Prepend(20); Assert.AreEqual(stack[1].Value, 20); stack.Add(20); Assert.AreEqual(stack[5].Value, 20); stack[4].Prepend(20); Assert.AreEqual(stack[4].Value, 20); Assert.AreEqual(stack[0].Value, 0); Assert.AreEqual(stack[1].Value, 20); Assert.AreEqual(stack[2].Value, 1); Assert.AreEqual(stack[3].Value, 2); Assert.AreEqual(stack[4].Value, 20); Assert.AreEqual(stack[5].Value, 3); Assert.AreEqual(stack[6].Value, 20); }
public void EqualityForClassType() { var stack1 = new CircularStack <TestClass>(); for (int i = 0; i < 20; i++) { stack1.Add(new TestClass(i * 20.1)); } var stack2 = new CircularStack <TestClass>(); for (int i = 0; i < 20; i++) { stack2.Add(new TestClass(i * 20.1)); } Assert.AreEqual(stack1, stack2); }
public void Equals() { var d = new CircularStack <double>(); for (int i = 0; i < 20; i++) { d.Add(i); } var e = new CircularStack <double>(); for (int i = 0; i < 20; i++) { e.Add(i); } Assert.AreEqual(d, e); }