Пример #1
0
        private void MigrateLiftIfNeeded(ProgressState progressState)
        {
            var preparer = new LiftPreparer(_liftFilePath);

            if (preparer.IsMigrationNeeded())
            {
                preparer.MigrateLiftFile(progressState);
            }
            //now done in code as each entry is parsed in: preparer.PopulateDefinitions(progressState);
        }
Пример #2
0
        public void MigrateIfNeeded_AlreadyCurrentLift_LiftUntouched()
        {
            CreateLiftFileForTesting(Validator.LiftVersion);
            DateTime     startModTime = File.GetLastWriteTimeUtc(_liftFilePath);
            LiftPreparer preparer     = new LiftPreparer(_liftFilePath);

            Assert.IsFalse(preparer.IsMigrationNeeded(), "IsMigrationNeeded Failed");
            DateTime finishModTime = File.GetLastWriteTimeUtc(_liftFilePath);

            Assert.AreEqual(startModTime, finishModTime);
        }
Пример #3
0
        private XmlDocument PopulateDefinitionsInDom(string entriesXml)
        {
            XmlDocument doc = new XmlDocument();

            CreateLiftFileForTesting(Validator.LiftVersion, entriesXml);
            LiftPreparer preparer = new LiftPreparer(_liftFilePath);

            preparer.PopulateDefinitions(new ProgressState());
            Assert.IsTrue(File.Exists(_liftFilePath));
            doc.Load(_liftFilePath);
            return(doc);
        }
Пример #4
0
        public void MigrateIfNeeded_GivenLiftVersionPoint10_LiftFileHasCurrentLiftVersionNumber()
        {
            //nb: most migration testing is done in the LiftIO library where the actual
            //  migration happens.  So here we're ensuring that the migration mechanism was
            //  triggered, and that the process left us with a modified (but not renamed)
            //  lift file.
            //nb: 0.10 was the first version where we started provinding a migration path.
            //FLEx support for Lift started with 0.12
            CreateLiftFileForTesting("0.10");
            LiftPreparer preparer = new LiftPreparer(_liftFilePath);

            Assert.IsTrue(preparer.IsMigrationNeeded(), "IsMigrationNeeded Failed");
            preparer.MigrateLiftFile(new ProgressState());
            Assert.AreEqual(Validator.LiftVersion, Validator.GetLiftVersion(_liftFilePath));
            // Get rid of the other file, as well.
            var otherPathname = _liftFilePath.Replace(".", ".0.10.");

            if (File.Exists(otherPathname))
            {
                File.Delete(otherPathname);
            }
        }