Exemplo n.º 1
0
        public void TestCloneReferences()
        {
            CellRangeAddress[] cras = { new CellRangeAddress(0, 1, 0, 2), };
            MergeCellsRecord merge = new MergeCellsRecord(cras, 0, cras.Length);
            MergeCellsRecord clone = (MergeCellsRecord)merge.Clone();

            Assert.AreNotSame(merge, clone, "Merged and cloned objects are the same");

            CellRangeAddress mergeRegion = merge.GetAreaAt(0);
            CellRangeAddress cloneRegion = clone.GetAreaAt(0);
            Assert.AreNotSame(mergeRegion, cloneRegion,
                "Should not point to same objects when cloning");
            Assert.AreEqual(mergeRegion.FirstRow, cloneRegion.FirstRow,
                "New Clone Row From doesnt match");
            Assert.AreEqual(mergeRegion.LastRow, cloneRegion.LastRow,
                "New Clone Row To doesnt match");
            Assert.AreEqual(mergeRegion.FirstColumn, cloneRegion.FirstColumn,
                "New Clone Col From doesnt match");
            Assert.AreEqual(mergeRegion.LastColumn, cloneRegion.LastColumn,
                "New Clone Col To doesnt match");

            Assert.IsFalse(merge.GetAreaAt(0) == clone.GetAreaAt(0));
        }
Exemplo n.º 2
0
 private void AddMergeCellsRecord(MergeCellsRecord mcr)
 {
     int nRegions = mcr.NumAreas;
     for (int i = 0; i < nRegions; i++)
     {
         _mergedRegions.Add(mcr.GetAreaAt(i));
     }
 }