예제 #1
0
        public void TestEquals()
        {
            ShortList list = new ShortList();

            //Assert.AreEqual(list, list);
            Assert.IsTrue(list.Equals(list));
            Assert.IsTrue(!list.Equals(null));
            ShortList list2 = new ShortList(200);

            //Assert.AreEqual(list, list2);
            Assert.IsTrue(list.Equals(list2));
            //Assert.AreEqual(list2, list);
            Assert.IsTrue(list2.Equals(list));
            Assert.AreEqual(list.GetHashCode(), list2.GetHashCode());
            list.Add((short)0);
            list.Add((short)1);
            list2.Add((short)1);
            list2.Add((short)0);
            Assert.IsTrue(!list.Equals(list2));
            list2.RemoveValue((short)1);
            list2.Add((short)1);
            //Assert.AreEqual(list, list2);
            Assert.IsTrue(list.Equals(list2));
            //Assert.AreEqual(list2, list);
            Assert.IsTrue(list2.Equals(list));
            list2.Add((short)2);
            Assert.IsTrue(!list.Equals(list2));
            Assert.IsTrue(!list2.Equals(list));
        }