예제 #1
0
        public void Update_FROM_2015_01_05()
        {
            var filePath = Path.Combine(TestTempPath, "TestUpdate.cruise");

            try
            {
                using (var setup = new SQLiteDatastore(filePath))
                {
                    setup.Execute(CruiseDAL.Tests.SQL.CRUISECREATE_2015_01_05);
                }

                using (var datastore = new CruiseDatastore(filePath))
                {
                    var updater = new Updater_V2();
                    updater.Invoking(x => x.Update(datastore))
                    .Should().NotThrow();

                    var semVerActual   = new Version(datastore.DatabaseVersion);
                    var semVerExpected = new Version("2.7.0");

                    semVerActual.Major.Should().Be(semVerExpected.Major);
                    semVerActual.Minor.Should().Be(semVerExpected.Minor);

                    ValidateUpdate(datastore);
                }
            }
            finally
            {
                if (File.Exists(filePath))
                {
                    File.Delete(filePath);
                }
            }
        }
예제 #2
0
        public void Update_FROM_05_30_2013()
        {
            var filePath = Path.Combine(TestTempPath, "TestUpdate.cruise");

            try
            {
                using (var setup = new SQLiteDatastore(filePath))
                {
                    setup.Execute(CruiseDAL.Tests.SQL.CRUISECREATE_05_30_2013);
                }

                using (var database = new CruiseDatastore(filePath))
                {
                    var dataStore = new CruiseDatastore(filePath);

                    var updater = new Updater_V2();
                    updater.Invoking(x => x.Update(dataStore)).Should().Throw <IncompatibleSchemaException>();

                    database.CurrentTransaction.Should().BeNull();
                }
            }
            finally
            {
                if (File.Exists(filePath))
                {
                    File.Delete(filePath);
                }
            }
        }