public void ConvertReturnsCorrectRowCount() { var opts = new DataCopier.Options { }; opts.outputTable = tests.SqlServerWriterTests.TABLENAME; var count = DataCopier.Convert( opts, tests.XlsxTests.FILENAME, $"sql://{tests.SqlServerWriterTests.CONNECTIONSTRINGWITHDATABASE}" ); Assert.Equal(3, count); }
static void Main(string[] args) { CommandLine.Parser.Default.ParseArguments <cliOptions>(args) .WithParsed <cliOptions>(cliOpts => { var opts = new DataCopier.Options { bufferRows = cliOpts.bufferRows, //writer options truncate = cliOpts.truncate, inputTable = String.IsNullOrWhiteSpace(cliOpts.inputTable) ? null : cliOpts.inputTable.Trim(), // reader options outputTable = String.IsNullOrWhiteSpace(cliOpts.outputTable) ? null : cliOpts.outputTable.Trim(), skipRows = cliOpts.skipRows, leaveRows = cliOpts.leaveRows, skipColumns = cliOpts.skipColumns, maxColumns = cliOpts.maxColumns, worksheetNumber = cliOpts.worksheetNumber }; var startTime = DateTime.Now; int lines = 0; try { lines = DataCopier.Convert(opts, cliOpts.readerUrl.Trim(), cliOpts.writerUrl.Trim()); } catch (ArgumentException e) { Console.Error.WriteLine(e.Message); } var endTime = DateTime.Now; var elapsedSeconds = (endTime - startTime).TotalMilliseconds / 1000F; Console.WriteLine($"{lines} lines copied in {elapsedSeconds} seconds ({lines/elapsedSeconds} lines per second)."); // Console.WriteLine($"{.readerUrl} {opts.writerUrl}"); }) .WithNotParsed <cliOptions>((errs) => { // HelpText.AutoBuild<cliOptions>() }); }