Convenience functionality on top of System.IO.Abstractions
dotnet add package TestableIO.System.IO.Abstractions.Extensionsvar fs = new FileSystem();
//with extension
var current = fs.CurrentDirectory();
//without extension
var current = fs.DirectoryInfo.New(fs.Directory.GetCurrentDirectory());var current = new FileSystem().CurrentDirectory();
//create a "temp" subdirectory with extension
current.SubDirectory("temp").Create();
//create a "temp" subdirectory without extension
current.FileSystem.DirectoryInfo.New(current.FileSystem.Path.Combine(current.FullName, "temp")).Create();var current = new FileSystem().CurrentDirectory();
//create a "test.txt" file with extension
using (var stream = current.File("test.txt").Create())
stream.Dispose();
//create a "test.txt" file without extension
using (var stream = current.FileSystem.FileInfo.New(current.FileSystem.Path.Combine(current.FullName, "test.txt")).Create())
stream.Dispose();var fs = new FileSystem();
var current = fs.CurrentDirectory();
//source
var source = fs.DirectoryInfo.New(fs.Path.Combine(current.FullName, "SourceDir"));
//destination
var dest = fs.DirectoryInfo.New(fs.Path.Combine(current.FullName, "DestDir"));
//copy
source.CopyTo(dest, recursive: true);