public void GetDatabaseHistoryDifferenceTest() { DatabaseDiffer target = new DatabaseDiffer(); ConnectionData goldenCopy = new ConnectionData() { DatabaseName = "SqlBuildTest_SyncTest1", SQLServerName = @"localhost\SQLEXPRESS", AuthenticationType = AuthenticationType.Windows }; ConnectionData toBeUpdated = new ConnectionData() { DatabaseName = "SqlBuildTest_SyncTest2", SQLServerName = @"localhost\SQLEXPRESS", AuthenticationType = AuthenticationType.Windows }; DatabaseRunHistory actual; actual = target.GetDatabaseHistoryDifference(goldenCopy, toBeUpdated); Assert.AreEqual(3, actual.BuildFileHistory.Count); //check that they are in chron order Assert.IsTrue(actual.BuildFileHistory[0].CommitDate < actual.BuildFileHistory[1].CommitDate); Assert.IsTrue(actual.BuildFileHistory[1].CommitDate < actual.BuildFileHistory[2].CommitDate); Assert.AreEqual("7E704479328C9B2FDA48C7CF093B16F125EAB98A", actual.BuildFileHistory[2].BuildFileHash); }
public void SyncronizeDatabasesTest_SyncWorkedAndSticks() { DatabaseSyncer target = new DatabaseSyncer(); ConnectionData gold = new ConnectionData() { DatabaseName = "SqlBuildTest_SyncTest1", SQLServerName = @"localhost\SQLEXPRESS", AuthenticationType = AuthenticationType.Windows }; ConnectionData toUpdate = new ConnectionData() { DatabaseName = "SqlBuildTest_SyncTest2", SQLServerName = @"localhost\SQLEXPRESS", AuthenticationType = AuthenticationType.Windows }; target.SyncronizationInfoEvent += new DatabaseSyncer.SyncronizationInfoEventHandler(target_SyncronizationInfoEvent); bool success = target.SyncronizeDatabases(gold, toUpdate, false); DatabaseDiffer differ = new DatabaseDiffer(); var history = differ.GetDatabaseHistoryDifference(gold, toUpdate); CleanUpSyncTest2(); Assert.AreEqual(0, history.BuildFileHistory.Count); }
public static DatabaseRunHistory GetDatabaseRunHistoryDifference(CommandLineArgs cmdLine) { if (cmdLine == null) { return(null); } DatabaseDiffer differ = new DatabaseDiffer(); return(differ.GetDatabaseHistoryDifference(cmdLine.SynchronizeArgs.GoldServer, cmdLine.SynchronizeArgs.GoldDatabase, cmdLine.Server, cmdLine.Database)); }
public void GetDatabaseHistoryDifferenceTest_SameSource() { DatabaseDiffer target = new DatabaseDiffer(); ConnectionData goldenCopy = new ConnectionData() { DatabaseName = "SqlBuildTest_SyncTest1", SQLServerName = @"localhost\SQLEXPRESS", AuthenticationType = AuthenticationType.Windows }; ConnectionData toBeUpdated = new ConnectionData() { DatabaseName = "SqlBuildTest_SyncTest1", SQLServerName = @"localhost\SQLEXPRESS", AuthenticationType = AuthenticationType.Windows }; DatabaseRunHistory actual; actual = target.GetDatabaseHistoryDifference(goldenCopy, toBeUpdated); Assert.AreEqual(0, actual.BuildFileHistory.Count); }
public static string GetDatabaseRunHistoryTextDifference(CommandLineArgs cmdLine) { cmdLine = ValidateFlags(cmdLine); if (cmdLine == null) { return(null); } DatabaseDiffer differ = new DatabaseDiffer(); var history = differ.GetDatabaseHistoryDifference(cmdLine.SynchronizeArgs.GoldServer, cmdLine.SynchronizeArgs.GoldDatabase, cmdLine.Server, cmdLine.Database); //= GetDatabaseRunHistoryDifference(cmdLine); string header = String.Format("{0} Package differences found between Gold:[{1}].[{2}] and Target:[{3}].[{4}]\r\n", history.BuildFileHistory.Count(), cmdLine.SynchronizeArgs.GoldServer, cmdLine.SynchronizeArgs.GoldDatabase, cmdLine.Server, cmdLine.Database); if (history.BuildFileHistory.Any()) { return(header + history.ToString()); } else { return("No differences found"); } }