public void FillTable_WithHeaders(int rowCount, Type[] colTypes, string[] colNames)
        {
            BasicFrame frame = BasicFrameGenerator.CreateTable(rowCount, colTypes, colNames);

            ExcelFile excelFile = new ExcelFile();
            ExcelWorksheet ws = excelFile.Worksheets.Add("test");
            excelFile.Worksheets.ActiveWorksheet = ws;

            BasicFrameToExcelWriter writer = new BasicFrameToExcelWriter();
            writer.ExportHeaders = true;
            writer.FillTable(ws, frame);

            Assert.Equal(frame.RowCount+1, ws.Rows.Count);
              //  Assert.Equal(frame.ColumnCount, ws.Columns.Count);
        }
        public void SetHeaders(int id, string[] colNames)
        {
            ExcelFile excelFile = new ExcelFile();
            ExcelWorksheet ws = excelFile.Worksheets.Add("test");
            excelFile.Worksheets.ActiveWorksheet = ws;

            BasicFrameToExcelWriter writer = new BasicFrameToExcelWriter();
            writer.ExportHeaders = true;
            writer.SetHeaders(ws, colNames);

            Assert.Equal(1, ws.Rows.Count);
            for (int i = 0; i < colNames.Length; i++)
            {
                Assert.Equal(colNames[i], ws.Cells[0, i].Value);
            }
            //     Assert.Equal(frame.ColumnCount, ws.Columns.Count);
        }
        public void SetParams(string fileName, int rowCount, Type[] colTypes, bool exportHeaders, bool exportRowKeys)
        {
            IFrame frame = BasicFrameGenerator.CreateTable(rowCount, colTypes);
            Dictionary<string, object> paramDic = new Dictionary<string, object>();
            paramDic.Add(BasicFrameToExcelWriter._ParamName_FileName, fileName);
            paramDic.Add(BasicFrameToExcelWriter._ParamName_InputFrame, frame);
            paramDic.Add(BasicFrameToExcelWriter._ParamName_ExportHeaders, exportHeaders);

            BasicFrameToExcelWriter writer = new BasicFrameToExcelWriter();
            writer.SetParams(paramDic);
            Assert.Equal(fileName, writer.FileName);
            Assert.Same(frame, writer.InputFrame);
            Assert.Equal(exportHeaders, writer.ExportHeaders);
        }
        public void WriteToFile_WithHeaders(string fileName, int rowCount, Type[] colTypes, int expectedLineCount, string[] colNames)
        {
            string inputFile = Path.Combine(_TestDir, fileName);
            IFrame frame = BasicFrameGenerator.CreateTable(rowCount, colTypes, colNames);

            BasicFrameToExcelWriter writer = new BasicFrameToExcelWriter();
            writer.FileName = inputFile;
            writer.ExportHeaders = true;
            writer.InputFrame = frame;
            writer.Write();

            var exists = File.Exists(inputFile);
            Assert.True(exists);
        }
 public void SetUp()
 {
     this.target = new BasicFrameToExcelWriter();
     Directory.CreateDirectory(_TestDir);
 }
 public void SetParam_ForFrame(int rowCount, Type[] colTypes)
 {
     IFrame frame = BasicFrameGenerator.CreateTable(rowCount, colTypes);
     BasicFrameToExcelWriter writer = new BasicFrameToExcelWriter();
     writer.SetParam(BasicFrameToExcelWriter._ParamName_InputFrame, frame);
     Assert.Same(frame, writer.InputFrame);
 }
 public void SetParam_ForFileName(string fileName)
 {
     BasicFrameToExcelWriter writer = new BasicFrameToExcelWriter();
     writer.SetParam(BasicFrameToExcelWriter._ParamName_FileName, fileName);
     Assert.Equal(fileName, writer.FileName);
 }
 public void SetParam_ForExportHeaders(bool exportHeaders)
 {
     BasicFrameToExcelWriter writer = new BasicFrameToExcelWriter();
     writer.SetParam(BasicFrameToExcelWriter._ParamName_ExportHeaders, exportHeaders);
     Assert.Equal(exportHeaders, writer.ExportHeaders);
 }