Пример #1
0
 public void BadDeltaRollBackTransaction()
 {
     deltaRunner = DeltaRunnerFactory.CreateDeltaRunner(ConnectionString, deltaPath2, false);
     deltaRunner.RemoveDeltaRunner();
     deltaRunner.PrepareForDeltaRunner();
     Assert.AreEqual("0", deltaRunner.GetLatestVersion());
     deltaRunner.ApplyDeltas(true);
     Assert.AreEqual("0", deltaRunner.GetLatestVersion());
 }
Пример #2
0
 public void ApplyDeltaWhenColumnNull()
 {
     deltaRunner = DeltaRunnerFactory.CreateDeltaRunner(ConnectionString, deltaPath, false);
     deltaRunner.RemoveDeltaRunner();
     deltaRunner.PrepareForDeltaRunner();
     ExecuteNonQuery(string.Format("update {0} set {1} = null", deltaRunner.DeltaVersionTableName, deltaRunner.DeltaVersionColumnName));
     Assert.AreEqual("0", deltaRunner.GetLatestVersion());
     deltaRunner.ApplyDeltas();
     Assert.AreEqual("00003", deltaRunner.GetLatestVersion());
 }
Пример #3
0
 public void ApplyDeltasReturnBooleanResult()
 {
     deltaRunner = DeltaRunnerFactory.CreateDeltaRunner(ConnectionString, deltaPath2, true);
     deltaRunner.RemoveDeltaRunner();
     deltaRunner.PrepareForDeltaRunner();
     ExecuteNonQuery("insert into dr_deltaversion ([latestdelta], [hash], [filename]) VALUES ('00001', 'xstD0qrfGt7um9h/rqKnLQ==', '00001.sql')");
     ExecuteNonQuery("insert into dr_deltaversion ([latestdelta], [hash], [filename]) VALUES ('00002', '6eOnIXx84dCOru/ArcGkog==', '00002.sql')");
     Assert.AreEqual("00002", deltaRunner.GetLatestVersion());
     Assert.IsTrue(deltaRunner.ApplyDeltas());
     Assert.AreEqual("00003", deltaRunner.GetLatestVersion());
     Assert.IsFalse(deltaRunner.ApplyDeltas());
     Assert.AreEqual("00003", deltaRunner.GetLatestVersion());
 }
Пример #4
0
        public void deltaRunnerUpdatesItself_OnlyExecuteNewerDeltas()
        {
            deltaRunner = DeltaRunnerFactory.CreateDeltaRunner(ConnectionString, deltaPath2, true);

            string oldVersionSql = @"
                    IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[dr_DeltaVersion]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
                        CREATE TABLE [dbo].[dr_DeltaVersion]
                        (
                            [LatestDelta] int
                            , [Hash] varchar(25)
                            , [Filename] varchar(255)
                        )";

            deltaRunner.RemoveDeltaRunner();

            ExecuteNonQuery(oldVersionSql);

            ExecuteNonQuery("INSERT INTO dr_DeltaVersion (LatestDelta, Hash, Filename) VALUES(1, 'blahblah', '00001.sql')");
            ExecuteNonQuery("INSERT INTO dr_DeltaVersion (LatestDelta, Hash, Filename) VALUES(2, 'blahblah', '00002.sql')");

            deltaRunner.PrepareForDeltaRunner();

            Assert.AreEqual("00002", deltaRunner.GetLatestVersion());

            deltaRunner.ApplyDeltas();

            Assert.AreEqual("00003", deltaRunner.GetLatestVersion());

            deltaRunner.ApplyDeltas();
            deltaRunner.ApplyDeltas();
        }