コード例 #1
0
        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);
        }
コード例 #2
0
        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]);
            }
        }