public static void Should_Clone_InterfacesObject() { var original = new InterfaceObject() { BoolValue = true, IntValue = 10, DictionaryValue = new Dictionary <int, BasicObject> { { 1, new BasicObject() { IntValue = 1, LongValue = 10 } }, { 2, new BasicObject() { IntValue = 2, LongValue = 20 } }, { 3, new BasicObject() { IntValue = 3, LongValue = 30 } }, }, }; InterfaceObject cloned = original.Clone(); cloned.ShouldBe(original); }
public static void ModifiedClone_InterfaceObject_ShouldNotBeEqual() { var original = new InterfaceObject() { BoolValue = true, IntValue = 10, DictionaryValue = new Dictionary <int, BasicObject> { { 1, new BasicObject() { IntValue = 1, LongValue = 10 } }, { 2, new BasicObject() { IntValue = 2, LongValue = 20 } }, { 3, new BasicObject() { IntValue = 3, LongValue = 30 } }, }, }; InterfaceObject cloned = original.Clone(); cloned.DictionaryValue[2].StringValue = "Test string"; cloned.ShouldNotBe(original); }
public void Should_Clone_InterfacesObject() { var original = new InterfaceObject() { BoolValue = true, IntValue = 10, DictionaryValue = new Dictionary <int, BasicObject> { { 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); }