コード例 #1
0
ファイル: BrundleFlyTest.cs プロジェクト: ninerats/DataTools
        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));

        }
コード例 #2
0
 private void cmdExecuteMigration_Click(object sender, System.EventArgs e)
 {
     UiWrap(() =>
     {
         var source = GetSource().AbortOnFail();
         string workingFolder = ExportToWorkingFolder(source).AbortOnFail();
         string msg = "Importing tables...";
         ShowStatus(msg);
         var importSource = new FolderDataTableSet(workingFolder)
         {
             Id = "Source Import Folder",
             TableList = source.TableList
         };
         var importResult = importSource.ImportTables(txtTargetDb.Text);
         if (!importResult.Success)
         {
             ShowStatus(importResult, "Importing tables");
             return;
         }
         var successMsg = string.Format("Migration to database target '{0}' complete. The following tables were imported:\r\n{1}",
            txtTargetDb.Text, string.Join("\r\n", importResult.Value.Select(t => "\t" + t)));
         ShowStatus(successMsg);
         File.WriteAllText(Path.Combine(workingFolder, "TableMigrationReport.txt"), successMsg);
         MessageBox.Show(string.Format("Migration complete. {0} tables migrated.", importResult.Value.Count())); ;
     }, "Migrating tables");
 }