public void UpdateFrom340_To_342()
        {
            var filePath = InitializeTestFile("UpdateFrom340_To_342.crz3");

            using var ds = new CruiseDatastore(filePath);

            var updater = new Updater_V3();

            updater.Update(ds);

            ds.Invoking(x => x.Execute("DELETE FROM Plot_Stratum;")).Should().NotThrow <FMSC.ORM.SQLException>();
        }
        public void Update(string fileName)
        {
            var filePath = InitializeTestFile(fileName);

            using (var ds = new CruiseDatastore(filePath))
            {
                var orgDbVersion = ds.DatabaseVersion;
                orgDbVersion.Should().Be(Path.GetFileNameWithoutExtension(fileName));

                var unitCount = ds.GetRowCount("CuttingUnit", "");


                var updater = new Updater_V3();

                updater.Update(ds);

                var unitCountAfter = ds.GetRowCount("CuttingUnit", "");
                unitCountAfter.Should().Be(unitCount);

                var verAfter = ds.DatabaseVersion;
                verAfter.Should().Be(CruiseDatastoreBuilder_V3.DATABASE_VERSION.ToString());

                var tableDefs = CruiseDatastoreBuilder_V3.TABLE_DEFINITIONS;
                foreach (var t in tableDefs)
                {
                    var ti = ds.GetTableInfo(t.TableName);
                    ti.Should().NotBeNullOrEmpty(t.TableName);
                }

                var sale = ds.From <Sale>().Query().Single();
                sale.Should().NotBeNull();

                var cruise = ds.From <Cruise>().Query().Single();
                cruise.SaleNumber.Should().Be(sale.SaleNumber);

                var logs = ds.From <Log>().Query().ToArray();
                if (logs.Any())
                {
                    logs.Should().OnlyContain(x => string.IsNullOrEmpty(x.CruiseID) == false);
                }

                // do integrity check
                var ic_results = ds.QueryScalar <string>("PRAGMA integrity_check;");
                ic_results.Should().HaveCount(1);
                ic_results.Single().Should().Be("ok");
            }
        }