public void DictionaryNotGetHashCodeWithArraysTest() { // setup string nameA = "Timmy"; var itemsA = new Dictionary <string, object> { { "a", "apple" }, { "b", new int[] { 907 } } }; string nameB = "Timmy"; var itemsB = new Dictionary <string, object> { { "a", "apple" }, { "b", new int[] { 909 } } }; var dictionaryContainerA = new ObjectDictionaryContainer { Name = nameA, Items = itemsA }; var dictionaryContainerB = new ObjectDictionaryContainer { Name = nameB, Items = itemsB }; // test var dictionaryContainerAHash = dictionaryContainerA.GetHashCode(); var dictionaryContainerBHash = dictionaryContainerB.GetHashCode(); // assert Assert.AreNotEqual(dictionaryContainerAHash, dictionaryContainerBHash); }
public void DictionaryGetHashCodeWithDeferencingTest() { // setup string nameA = "Timmy"; var itemsA = new Dictionary <string, object> { { "a", "apple" }, { "b", 32 } }; string nameB = "Timmy"; var itemsB = new Dictionary <string, object> { { "a", "apple" }, { "b", 32 } }; var dictionaryContainerA = new ObjectDictionaryContainer { Name = nameA, Items = itemsA }; var dictionaryContainerB = new ObjectDictionaryContainer { Name = nameB, Items = itemsB }; // test var dictionaryContainerAHash = dictionaryContainerA.GetHashCode(); var dictionaryContainerBHash = dictionaryContainerB.GetHashCode(); // assert Assert.AreEqual(dictionaryContainerAHash, dictionaryContainerBHash); }