Exemple #1
0
        protected virtual MemoryFileSystem CreateMockFilesystem()
        {
            var fs = new MemoryFileSystem();

            fs.CopyFile(Path.Combine("Resource", "AutoRest.json"), "AutoRest.json");
            return(fs);
        }
        internal static void CopyFolder(this MemoryFileSystem fileSystem, string basePath, string source, string destination)
        {
            fileSystem.CreateDirectory(destination);

            // Copy dirs recursively
            foreach (var child in Directory.EnumerateDirectories(Path.Combine(Core.Utilities.Extensions.CodeBaseDirectory(typeof(TestExtensions)), basePath, source)).Select(Path.GetFileName))
            {
                fileSystem.CopyFolder(basePath, Path.Combine(source, child), Path.Combine(destination, child));
            }

            // Copy files
            foreach (var childFile in Directory.EnumerateFiles(Path.Combine(Core.Utilities.Extensions.CodeBaseDirectory(typeof(TestExtensions)), basePath, source)).Select(Path.GetFileName))
            {
                fileSystem.CopyFile(Path.Combine(Core.Utilities.Extensions.CodeBaseDirectory(typeof(TestExtensions)), basePath, source, childFile), Path.Combine(destination, childFile));
            }
        }