public static void ModifiedClone_Dictionary_ShouldNotBeEqual() { var original = new DictionaryObject { Collection = { { 1, new BasicObject() { IntValue = 1, LongValue = 10 } }, { 2, new BasicObject() { IntValue = 2, LongValue = 20 } }, { 3, new BasicObject() { IntValue = 3, LongValue = 30 } }, } }; DictionaryObject cloned = original.Clone(); cloned.Collection[2].LongValue = 200; cloned.ShouldNotBe(original); }
public static void Should_Clone_DictionaryObject() { var original = new DictionaryObject { Collection = { { 1, new BasicObject() { IntValue = 1, LongValue = 10 } }, { 2, new BasicObject() { IntValue = 2, LongValue = 20 } }, { 3, new BasicObject() { IntValue = 3, LongValue = 30 } }, } }; DictionaryObject cloned = original.Clone(); cloned.ShouldBe(original); }
public void Should_Clone_DictionaryObject() { var original = new DictionaryObject { Collection = { { 1, new BasicObject() { IntValue = 1, LongValue = 10 } }, { 2, new BasicObject() { IntValue = 2, LongValue = 20 } }, { 3, new BasicObject() { IntValue = 3, LongValue = 30 } }, } }; var cloned = original.Clone(); Assert.AreEqual(original, cloned); }