protected void VerifyTablesCanDelete(CruiseDatastore datastore)
        {
            var tableNames = datastore.ExecuteScalar <string>("SELECT group_concat(Name) FROM sqlite_master WHERE Type = 'table';").Split(',');

            foreach (var table in tableNames)
            {
                try
                {
                    datastore.Execute($"DELETE FROM {table};");
                }
                catch (Exception e)
                {
                    Output.WriteLine(e.Message);
                    Output.WriteLine(e.InnerException.Message);
                }

                //datastore.Invoking(x => x.Execute($"DELETE FROM {table};")).Should().NotThrow();
            }
        }
        public static bool HasCruiseErrors(CruiseDatastore dal, out string[] errors)
        {
            bool hasErrors = false;
            var  errorList = new List <string>();

            if (dal.HasForeignKeyErrors(null))
            {
                errorList.Add("File contains Foreign Key errors");
                hasErrors = true;
            }

            if (HasMismatchSpecies(dal))
            {
                errorList.Add("Tree table has mismatch species codes");
                hasErrors = true;
            }

            if (HasSampleGroupUOMErrors(dal))
            {
                errorList.Add("Sample Group table has invalid mix of UOM");
                hasErrors = true;
            }

            if (HasBlankCountOrMeasure(dal))
            {
                errorList.Add("Tree table has record(s) with blank Count or Measure value");
                hasErrors = true;
            }
            if (HasBlankDefaultLiveDead(dal))
            {
                errorList.Add("Sample Group table has record(s) with blank default live dead vaule");
                hasErrors = true;
            }
            if (HasBlankLiveDead(dal))
            {
                errorList.Add("Tree table has record(s) with blank Live Dead value");
                hasErrors = true;
            }
            if (HasBlankSpeciesCodes(dal))
            {
                dal.Execute(
                    @"Update Tree
                SET Species =
                    (Select Species FROM TreeDefaultValue
                        WHERE TreeDefaultValue.TreeDefaultValue_CN = Tree.TreeDefaultValue_CN)
                WHERE ifnull(Tree.Species, '') = ''
                AND ifnull(Tree.TreeDefaultValue_CN, 0) != 0;");
                if (HasBlankSpeciesCodes(dal))
                {
                    errorList.Add("Tree table has record(s) with blank species or no tree default");
                    hasErrors = true;
                }
            }

            if (HasOrphanedStrata(dal))
            {
                errorList.Add("Stratum table has record(s) that have not been assigned to a cutting unit");
                hasErrors = true;
            }
            if (HasStrataWithNoSampleGroups(dal))
            {
                errorList.Add("Stratum table has record(s) that have not been assigned any sample groups");
                hasErrors = true;
            }

            errors = errorList.ToArray();
            return(hasErrors);
        }