private IFileSystem CreateFileSystem(bool withEntries = true) { var fileSystem = new IFileSystemMock(); if (withEntries) { fileSystem.CreateDirectory(RootLocation); fileSystem.CreateDirectory(BackupLocation); fileSystem.Create(XprojLocation); fileSystem.Create(ProjectJsonLocation); } return(fileSystem); }
private IFileSystem CreateFileSystem(bool withEntries = true, MigrationReport report = null, bool withXprojUser = false, bool withProjectLock = false, bool withGlobalJson = false) { var fileSystem = new IFileSystemMock(); if (withEntries) { fileSystem.CreateDirectory(RootLocation); fileSystem.CreateDirectory(BackupLocation); fileSystem.Create(XprojLocation); fileSystem.Create(ProjectJsonLocation); if (withXprojUser) { fileSystem.Create(XprojUserLocation); } if (withProjectLock) { fileSystem.Create(ProjectLockJsonLocation); } if (withGlobalJson) { fileSystem.WriteAllText(GlobalJsonLocation, JsonConvert.SerializeObject(new object())); } } fileSystem.SetTempFile(LogFileLocation); if (withEntries) { report = report ?? new MigrationReport(1, new List <ProjectMigrationReport>() { new ProjectMigrationReport(true, CsprojLocation, RootLocation, ProjectName, new List <string>(), new List <MigrationError>()) }); fileSystem.WriteAllText(LogFileLocation, JsonConvert.SerializeObject(report)); } return(fileSystem); }