public void SameHashCodeInsertTest()
        {
            var classMap = new ConcurrentDictionary <DumbClass, string> ();

            var class1 = new DumbClass(1);
            var class2 = new DumbClass(2);

            Assert.IsTrue(classMap.TryAdd(class1, "class1"), "class 1");
            Console.WriteLine();
            Assert.IsTrue(classMap.TryAdd(class2, "class2"), "class 2");

            Assert.AreEqual("class1", classMap[class1], "class 1 check");
            Assert.AreEqual("class2", classMap[class2], "class 2 check");
        }
Ejemplo n.º 2
0
        public void SameHashCodeInsertTest()
        {
            var classMap = new ConcurrentDictionary <DumbClass, string>();

            var class1 = new DumbClass(1);
            var class2 = new DumbClass(2);

            Assert.IsTrue(classMap.TryAdd(class1, nameof(class1)), "class 1");
            Debug.WriteLine(string.Empty);
            Assert.IsTrue(classMap.TryAdd(class2, nameof(class2)), "class 2");

            Assert.AreEqual(nameof(class1), classMap[class1], "class 1 check");
            Assert.AreEqual(nameof(class2), classMap[class2], "class 2 check");
        }