コード例 #1
0
        public void UpdateHeaderPropertiesTest()
        {
            Application application = new Application();

            try
            {
                Workbook book = application.OpenWorkbook("WorkbookTestData.xlsx", false);

                // Get the named range stored in the test data excel file.
                // This range refers to address "$A$1:$D$7".
                Name oldName = book.Names.GetNamedRange("GetSelectedLayerWorksheet");
                Name newName = book.Names.GetNamedRange("UpdateHeaderPropertiesTestRADEC");

                LayerMap selectedlayer = new LayerMap(oldName);

                Range selectedRange = newName.RefersToRange;
                LayerMapExtensions.UpdateHeaderProperties(selectedlayer, selectedRange);
                Assert.AreEqual(selectedlayer.MappedColumnType[0], ColumnType.RA);
                Assert.AreEqual(selectedlayer.MappedColumnType[1], ColumnType.Dec);
            }
            finally
            {
                application.Close();
            }
        }
コード例 #2
0
        public void UpdateHeaderPropertiesTestNull()
        {
            Application application = new Application();

            try
            {
                LayerMap selectedlayer = new LayerMap(new Layer());
                LayerMapExtensions.UpdateHeaderProperties(selectedlayer, null);
                LayerMapExtensions.UpdateHeaderProperties(null, null);
                Assert.IsNull(selectedlayer.RangeAddress);
            }
            finally
            {
                application.Close();
            }
        }