Esempio n. 1
0
        public void Suitable_For_Determining_Uniqueness_In_Hashtable()
        {
            var foo = new Object();
            var bar = new Object();

            var list1 = new EquatableList <Object> {
                foo, bar
            };
            var list2 = new EquatableList <Object> {
                foo, bar
            };

            var hashTable = new Hashtable();

            Assert.IsFalse(hashTable.ContainsKey(list1));
            hashTable.Add(list1, list1);

            Assert.IsTrue(hashTable.ContainsKey(list2));
        }
Esempio n. 2
0
        public void Suitable_For_Determining_Uniqueness_In_HashSet()
        {
            var foo = new Object();
            var bar = new Object();

            var list1 = new EquatableList <Object> {
                foo, bar
            };
            var list2 = new EquatableList <Object> {
                foo, bar
            };

            Assert.AreEqual(list1, list2);

            var hashSet = new HashSet <IList <Object> >();

            Assert.IsTrue(hashSet.Add(list1));
            Assert.IsFalse(hashSet.Add(list2));
        }