public void TestReference(CopyableDataClassA Original, CopyableDataClassA Copy) { Assert.IsFalse(Object.ReferenceEquals(Original, Copy), "A copy was not created"); Assert.IsFalse(Object.ReferenceEquals(Original.Name, Copy.Name), "A copy name was not created"); Assert.IsFalse(Object.ReferenceEquals(Original.Data, Copy.Data), "A copy data was not created"); Assert.IsFalse(Object.ReferenceEquals(Original.Data.Name, Copy.Data.Name), "A copy data name was not created"); //Result is always false //Assert.IsFalse(Object.ReferenceEquals(Original.Data.Test, Copy.Data.Test), "A copy data test was not created"); }
public void TestSingle() { CopyableDataClassA Original = this.NewData(); CopyableDataClassA Copy = Original.Copy(); this.TestReference(Original, Copy); Copy.Data.Test = 2; Copy.Name = ""; Assert.IsFalse(Copy.Name == Original.Name); Assert.IsFalse(Copy.Data.Test == Original.Data.Test); }
public void TestArray() { CopyableDataClassA[] Originals = new CopyableDataClassA[10]; for (Int32 I = 0; I < 10; I++) { Originals[I] = this.NewData(); } CopyableDataClassA[] Copy = Originals.Copy(); Assert.IsFalse(Object.ReferenceEquals(Originals, Copy), "A copy was not created"); Assert.IsTrue(Originals.Length == Copy.Length, "Not the same amount of elements"); for (Int32 I = 0; I < Originals.Length; I++) { this.TestReference(Originals[I], Copy[I]); } }