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 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);
        }
示例#3
0
        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 GetDatabaseRunHistoryTest_TestCountAndSelection()
        {
            DatabaseDiffer target     = new DatabaseDiffer();
            ConnectionData dbConnData = new ConnectionData()
            {
                DatabaseName       = "SqlBuildTest_SyncTest1",
                SQLServerName      = @"localhost\SQLEXPRESS",
                AuthenticationType = AuthenticationType.Windows
            };

            DatabaseRunHistory actual;

            actual = target.GetDatabaseRunHistory(dbConnData);
            Assert.AreEqual(3, actual.BuildFileHistory.Count);

            Assert.AreEqual(DateTime.Parse("2014-07-21 13:58:07.880"),
                            actual.BuildFileHistory.Where(x => x.BuildFileHash == "7651E282160CAF9C92CB923004D94B91181C077E").Select(y => y.CommitDate).FirstOrDefault());
        }
        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);
        }
示例#6
0
        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");
            }
        }
        public void DatabaseDifferConstructorTest()
        {
            DatabaseDiffer target = new DatabaseDiffer();

            Assert.IsNotNull(target);
        }