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"); } }
private static bool HasBlankCountOrMeasure(CruiseDatastore dal) { return(dal.GetRowCount(TREE._NAME, "WHERE ifnull(CountOrMeasure, '') = ''") > 0); }
private static bool HasBlankLiveDead(CruiseDatastore dal) { return(dal.GetRowCount(TREE._NAME, "WHERE ifnull(LiveDead, '') = ''") > 0); }
private static bool HasBlankSpeciesCodes(CruiseDatastore dal) { return(dal.GetRowCount(TREE._NAME, "WHERE ifnull(Species, '') = ''") > 0); }
private static bool HasStrataWithNoSampleGroups(CruiseDatastore dal) { return(dal.GetRowCount("Stratum", "LEFT JOIN SampleGroup USING (Stratum_CN) WHERE SampleGroup.Stratum_CN IS NULL") > 0); }
private static bool HasOrphanedStrata(CruiseDatastore dal) { return(dal.GetRowCount("Stratum", "LEFT JOIN CuttingUnitStratum USING (Stratum_CN) WHERE CuttingUnitStratum.Stratum_CN IS NULL") > 0); }
private static bool HasMismatchSpecies(CruiseDatastore dal) { return(dal.GetRowCount("Tree", "JOIN TreeDefaultValue AS tdv USING (TreeDefaultValue_CN) WHERE Tree.Species != tdv.Species;") > 0); }
private static bool HasBlankDefaultLiveDead(CruiseDatastore dal) { return(dal.GetRowCount(SAMPLEGROUP._NAME, "WHERE ifnull(DefaultLiveDead, '') = ''") > 0); }