예제 #1
0
        public void RoundTripComparisonTest()
        {
            var sw = new Stopwatch();
            Debug.WriteLine("Starting Test:");
            sw.Start();
            var importFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "FolderDTC");
            var importDts = new FolderDataTableSet(importFolder)
            {
                Id = "Import DataSet",
                TableList = TableList
            };

            var connStr = DataSerTestHelper.DataDiffConnectionString;

            Debug.WriteLine(string.Format("Starting import...  elpased: {0}", sw.Elapsed));
            var importResult = importDts.ImportTables(connStr);
            Debug.WriteLine(string.Format("Import complete: {0}", sw.Elapsed));
            DataSerTestHelper.AssertResult(importResult);
            Debug.WriteLine(string.Format("Starting export...  elpased: {0}", sw.Elapsed));
            var exportFolder = TestHelper.ResetFolder("Export");
            var exportDts = new DatabaseDataTableSet(connStr)
            {
                Id = "Export DataSet",
                TableList = TableList
            };

            var exportResult = exportDts.ExportTables(exportFolder);
            Debug.WriteLine(string.Format("export complete: {0}", sw.Elapsed));
            DataSerTestHelper.AssertResult(exportResult);

            Debug.WriteLine("Asserting exported files are the same as the originals...");
            AssertFolderContentsAreEqual(importFolder, exportFolder);
            Debug.WriteLine(string.Format("Total time: {0}", sw.Elapsed));

        }
 private ReturnValue<string> ExportToWorkingFolder(DatabaseDataTableSet source)
 {
     var workingFolder = txtWorkingFolder.Text;
     return ReturnValue<string>.Wrap(() =>
     {
         if (!Directory.Exists(workingFolder))
             ReturnValue.Abort(string.Format("The working folder '{0}' does not exist.", txtWorkingFolder));
         var msg = string.Format("Exporting tables to '{0}'...", workingFolder);
         ShowStatus(msg);
         ShowStatus(source.ExportTables(workingFolder), msg);
         return workingFolder;
     }, string.Format("Exporting DatatableSet to '{0}.", workingFolder));
 }