Ejemplo n.º 1
0
        public void MountUpgradesFromEsentDatabasesToFlatDatabases()
        {
            this.Enlistment.UnmountGVFS();

            // Delete the existing background ops data
            string flatBackgroundPath = Path.Combine(this.Enlistment.DotGVFSRoot, GVFSHelpers.BackgroundOpsFile);

            flatBackgroundPath.ShouldBeAFile(this.fileSystem);
            this.fileSystem.DeleteFile(flatBackgroundPath);

            // Delete the existing placeholder data
            string flatPlaceholdersPath = Path.Combine(this.Enlistment.DotGVFSRoot, GVFSHelpers.PlaceholderListFile);

            flatPlaceholdersPath.ShouldBeAFile(this.fileSystem);
            this.fileSystem.DeleteFile(flatPlaceholdersPath);

            GVFSHelpers.CreateEsentBackgroundOpsDatabase(this.Enlistment.DotGVFSRoot);
            GVFSHelpers.CreateEsentPlaceholderDatabase(this.Enlistment.DotGVFSRoot);

            // Nine is the last version with ESENT BackgroundOps and Placeholders DBs
            GVFSHelpers.SaveDiskLayoutVersion(this.Enlistment.DotGVFSRoot, "9");
            this.Enlistment.MountGVFS();

            GVFSHelpers.GetPersistedDiskLayoutVersion(this.Enlistment.DotGVFSRoot)
            .ShouldBeAnInt("Disk layout version should always be an int")
            .ShouldEqual(CurrentDiskLayoutVersion);

            flatBackgroundPath.ShouldBeAFile(this.fileSystem);
            flatPlaceholdersPath.ShouldBeAFile(this.fileSystem);
        }