Beispiel #1
0
        public void MigrateToLatestVersion_IsOldVersion_ReturnsDifferentPath()
        {
            string path         = null;
            string pathMigrated = null;

            try
            {
                path         = TempOxesFiles.MinimalVersion107File(null);
                pathMigrated = Migrator.MigrateToLatestVersion(path);
                Assert.AreNotEqual(path, pathMigrated);
                string errors = Validator.GetAnyValidationErrors(pathMigrated);
                Assert.IsNull(errors);
            }
            finally
            {
                if (!String.IsNullOrEmpty(path))
                {
                    File.Delete(path);
                }
                if (!String.IsNullOrEmpty(pathMigrated) && pathMigrated != path)
                {
                    File.Delete(pathMigrated);
                }
            }
        }
Beispiel #2
0
        public void WrongVersionNumberGivesHelpfulMessage()
        {
            string path   = TempOxesFiles.MinimalVersion107File(null);
            string errors = ValidateAndDelete(path, false);

            Assert.IsTrue(errors.Contains("This file claims to be version"));
        }
Beispiel #3
0
        public void MigrateToLatestVersion_BadVersion_Throws()
        {
            string path = null;

            try
            {
                path = TempOxesFiles.MinimalVersion099File(null);
                Migrator.MigrateToLatestVersion(path);
            }
            finally
            {
                if (!String.IsNullOrEmpty(path))
                {
                    File.Delete(path);
                }
            }
        }
Beispiel #4
0
        public void IsMigrationNeeded_Latest_ReturnsFalse()
        {
            string path = null;

            try
            {
                path = TempOxesFiles.MinimalValidFile(null);
                Assert.IsFalse(Migrator.IsMigrationNeeded(path));
            }
            finally
            {
                if (!String.IsNullOrEmpty(path))
                {
                    File.Delete(path);
                }
            }
        }
Beispiel #5
0
        public void Validate_SmallFile_Succeeds()
        {
            string path = TempOxesFiles.SmallValidFile(null);

            ValidateAndDelete(path, true);
        }
Beispiel #6
0
        public void Validate_TinyBadFile_Fails()
        {
            string path = TempOxesFiles.BadMinimalFile(null);

            ValidateAndDelete(path, false);
        }
Beispiel #7
0
        public void Validate_EmptyFile_Fails()
        {
            string path = TempOxesFiles.EmptyOxesFile(null);

            ValidateAndDelete(path, false);
        }