Esempio n. 1
0
        public void Test1()
        {
            var c     = ComplexClass.CreateForTests();
            var cCopy = (ComplexClass)CopyFunctionSelection._copyMethod(c);

            // test that the copy is a different instance but with equal content
            Assert_AreEqualButNotSame(c, cCopy);

            // test that the same subobjects should remain the same in a copy (we put same objects to different dictionaries)
            Assert.AreSame(cCopy._sampleDictionary[typeof(ComplexClass).ToString()],
                           cCopy.ISampleDictionary[typeof(ComplexClass).ToString()]);
            Assert.AreSame(cCopy._sampleDictionary[typeof(ModerateClass).ToString()],
                           cCopy.ISampleDictionary[typeof(ModerateClass).ToString()]);
            Assert.AreNotSame(cCopy._sampleDictionary[typeof(SimpleClass).ToString()],
                              cCopy.ISampleDictionary[typeof(SimpleClass).ToString()]);
            Assert.AreSame(cCopy._iSimpleMultiDimArray[0, 0, 0], cCopy._simpleMultiDimArray[1][1][1]);
        }