Esempio n. 1
0
        public void SequenceData()
        {
            if (!TestHelper.GetDlcPath(out string dlcPath))
            {
                return;
            }

            var db = GetDb("seqdata");

            // create .df
            var dfPath = Path.Combine(TestFolder, "seqdata.df");

            File.WriteAllText(dfPath, "ADD SEQUENCE \"sequence1\"\n  INITIAL 0\n  INCREMENT 1\n  CYCLE-ON-LIMIT no\n\nADD SEQUENCE \"sequence2\"\n  INITIAL 0\n  INCREMENT 1\n  CYCLE-ON-LIMIT no\n");

            using (var dataAdmin = new UoeDatabaseAdministrator(dlcPath)) {
                dataAdmin.CreateWithDf(db, dfPath);

                var sequenceDataFilePath = Path.Combine(TestFolder, $"{db.PhysicalName}.d");

                // load seq
                File.WriteAllText(sequenceDataFilePath, "0 \"sequence1\" 20\n");
                dataAdmin.LoadSequenceData(dataAdmin.GetDatabaseConnection(db), sequenceDataFilePath);

                // dump seq
                File.Delete(sequenceDataFilePath);
                dataAdmin.DumpSequenceData(dataAdmin.GetDatabaseConnection(db), sequenceDataFilePath);

                Assert.IsTrue(File.Exists(sequenceDataFilePath));
                var dataContent = File.ReadAllText(sequenceDataFilePath);
                Assert.IsTrue(dataContent.Contains("\"sequence1\" 20"));
                Assert.IsTrue(dataContent.Contains("\"sequence2\" 0"));
            }
        }
Esempio n. 2
0
        public void GenerateAdvisorReport()
        {
            if (!TestHelper.GetDlcPath(out string dlcPath))
            {
                return;
            }

            using (var ope = new UoeDatabaseAdministrator(dlcPath)) {
                var db = GetDb("advisor");

                ope.Create(db);
                Assert.IsTrue(db.Exists());

                var output = Path.Combine(TestFolder, "advisor.html");

                ope.GenerateAdvisorReport(ope.GetDatabaseConnection(db), output);

                Assert.IsTrue(File.Exists(output));
            }
        }