public void Exporters_XlsExporter_insertRowLinks_RelativeLink()
        {
            FileInfo outfile = new FileInfo(@"X:\noWhere.xlsx");

            string[] exportFields        = new string[] { "DOCID", "BEGATT", "VOLUME", "NATIVE" };
            Representative.FileType type = Representative.FileType.Native;
            string display = null;
            int    index   = 3;

            docs.First().Metadata["NATIVE"] = @"\NATIVE\0001\DOC000001.XLSX";
            docs.First().Representatives.First().Files["DOC000001"] = @"\NATIVE\0001\DOC000001.XLSX";
            HyperLinkInfo link = new HyperLinkInfo(type, display, index);

            HyperLinkInfo[] links  = new HyperLinkInfo[] { link };
            TestExporter    tester = new TestExporter(outfile, exportFields, links);
            DataTable       dt      = tester.getMetaDataTable(this.docs);
            FileInfo        file    = new FileInfo("test.xlsx");
            ExcelPackage    package = new ExcelPackage(file);
            ExcelWorksheet  ws      = package.Workbook.Worksheets.Add("Sheet1");

            ws.Cells[1, 1].LoadFromDataTable(dt, true);
            Document doc       = docs.First();
            int      row       = 0;
            int      col       = 3;
            string   linkValue = @".\NATIVE\0001\DOC000001.XLSX";

            tester.insertRowLinks(ws, dt, doc, row);
            string expected = String.Format(
                "HYPERLINK(\"{0}\", \"{1}\")", linkValue, "\\NATIVE\\0001\\DOC000001.XLSX");
            string actual = ws.Cells[row + 2, col + 1].Formula;

            Assert.AreEqual(expected, actual);
        }
        public void Exporters_XlsExporter_insertRowLinks_NoLink()
        {
            FileInfo outfile = new FileInfo(@"X:\noWhere.xlsx");

            string[] exportFields        = new string[] { "DOCID", "BEGATT", "VOLUME", "NATIVE" };
            Representative.FileType type = Representative.FileType.Native;
            string        display        = null;
            int           index          = 3;
            HyperLinkInfo link           = new HyperLinkInfo(type, display, index);

            HyperLinkInfo[] links   = new HyperLinkInfo[] { link };
            TestExporter    tester  = new TestExporter(outfile, exportFields, links);
            DataTable       dt      = tester.getMetaDataTable(this.docs);
            FileInfo        file    = new FileInfo("test.xlsx");
            ExcelPackage    package = new ExcelPackage(file);
            ExcelWorksheet  ws      = package.Workbook.Worksheets.Add("Sheet1");

            ws.Cells[1, 1].LoadFromDataTable(dt, true);
            Document doc = docs[1];
            int      row = 0;
            int      col = 3;

            tester.insertRowLinks(ws, dt, doc, row);
            string expected = String.Empty;
            string actual   = ws.Cells[row + 2, col + 1].Formula;

            Assert.AreEqual(expected, actual);
        }
        public void Exporters_XlsExporter_getMetaDataTable()
        {
            FileInfo outfile = new FileInfo(@"X:\noWhere.xlsx");

            string[]        exportFields = new string[] { "DOCID", "BEGATT", "VOLUME", "NATIVE" };
            HyperLinkInfo[] links        = new HyperLinkInfo[] { };
            TestExporter    tester       = new TestExporter(outfile, exportFields, links);
            DataTable       dt           = tester.getMetaDataTable(this.docs);

            for (int i = 0; i < dt.Columns.Count; i++)
            {
                string expected = exportFields[i];
                string actual   = dt.Columns[i].ColumnName;
                Assert.AreEqual(expected, actual);
            }

            for (int row = 0; row < dt.Rows.Count; row++)
            {
                for (int col = 0; col < dt.Columns.Count; col++)
                {
                    string expected = docs[row].Metadata[dt.Columns[col].ColumnName];
                    string actual   = dt.Rows[row][col].ToString();
                    Assert.AreEqual(expected, actual);
                }
            }
        }