From cd22de677cf942c8bf82c8bbb6e02ee5630076eb Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 6 Aug 2018 09:19:53 +0300 Subject: Working on SQL Examiner Reports Loading.. --- .../Tango.UnitTesting/SQLExaminer_TST.cs | 56 ++++++++++++++++++---- 1 file changed, 47 insertions(+), 9 deletions(-) (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs index 84a81035b..32cd3eedb 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs @@ -81,24 +81,25 @@ namespace Tango.UnitTesting Helper.ShowInExplorer(config_path); } + [TestMethod] + public void LoadReport() + { + ExaminerDataReport report = ExaminerDataReport.FromFile("C:\\DATA\\report_data.xml"); + } + [TestMethod] public void Synchronize_Schema() { SqlConnection connection = new SqlConnection("Server=localhost\\SQLEXPRESS;Integrated security=SSPI"); - String command = @"CREATE DATABASE Test"; - - SqlCommand cmd = new SqlCommand(command, connection); - connection.Open(); - cmd.ExecuteNonQuery(); - ExaminerConfigurationBuilder builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.Schema); var temp_folder = Helper.GetTempFolderPath(); builder. SetSourceServer("localhost\\SQLEXPRESS", "Tango"). - SetTargetServer("localhost\\SQLEXPRESS", "Test"); + SetTargetServer("localhost\\SQLEXPRESS", "Test"). + SetReportFile("C:\\Data\\Report.xml"); var config = builder.Build(); @@ -121,7 +122,8 @@ namespace Tango.UnitTesting builder. SetSourceServer("localhost\\SQLEXPRESS", "Tango"). - SetTargetServer("localhost\\SQLEXPRESS", "Test"); + SetTargetServer("localhost\\SQLEXPRESS", "Test"). + SetReportFile("C:\\DATA\\report_data.xml"); var config = builder.Build(); @@ -130,7 +132,7 @@ namespace Tango.UnitTesting config.ToFile(config_path); ExaminerProcess process = new ExaminerProcess(config_path, ExaminerProcessType.Data); - process.Progress += (x, msg) => + process.Progress += (x, msg) => { Debug.WriteLine(msg); }; @@ -166,5 +168,41 @@ namespace Tango.UnitTesting Assert.AreEqual(result.ExitCode, ExaminerProcessExitCode.Success); } + + [TestMethod] + public void Perform_Full_DataBase_Cycle() + { + String temp_folder = Helper.GetTempFolderPath(); + + String tango_db = "Tango"; + String source_db = "Source_DB_Test"; + String target_db = "Target_DB_Test"; + + DbManager db = new DbManager(new SqlConnection("Server=localhost\\SQLEXPRESS;Integrated security=SSPI")); + Assert.IsTrue(db.Exists("Tango"), "Database Tango does not exists."); + + Assert.IsFalse(db.Exists(source_db), source_db + " already exists."); + Assert.IsFalse(db.Exists(target_db), target_db + " already exists."); + + db.Create(source_db); + db.Create(target_db); + + ExaminerConfigurationBuilder builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.Schema); + + builder. + SetSourceServer("localhost\\SQLEXPRESS", tango_db). + SetTargetServer("localhost\\SQLEXPRESS", source_db); + + var config = builder.Build(); + + String config_path = Path.Combine(temp_folder, "schema.xml"); + + config.ToFile(config_path); + + ExaminerProcess process = new ExaminerProcess(config_path, ExaminerProcessType.Schema); + var result = process.Execute().Result; + + Assert.AreEqual(result.ExitCode, ExaminerProcessExitCode.Success); + } } } -- cgit v1.3.1