public void TestExceptions() { var fs = new MemoryFileSystem(); Assert.Throws <ArgumentNullException>(() => fs.AppendAllText("/a.txt", null)); Assert.Throws <ArgumentNullException>(() => fs.WriteAllText("/a.txt", null)); Assert.Throws <ArgumentNullException>(() => fs.WriteAllText("/a.txt", "content", null)); Assert.Throws <ArgumentNullException>(() => fs.WriteAllText("/a.txt", null, null)); Assert.Throws <ArgumentNullException>(() => fs.ReadAllText("/a.txt", null)); Assert.Throws <ArgumentNullException>(() => fs.ReadAllLines("/a.txt", null)); Assert.Throws <ArgumentNullException>(() => fs.WriteAllBytes("/a", null)); Assert.Throws <ArgumentNullException>(() => fs.AppendAllText("/a", null, null)); Assert.Throws <ArgumentNullException>(() => fs.AppendAllText("/a", "content", null)); Assert.Throws <ArgumentNullException>(() => fs.EnumeratePaths("*", null).First()); Assert.Throws <ArgumentNullException>(() => fs.EnumeratePaths("*", null, SearchOption.AllDirectories).First()); Assert.Throws <ArgumentNullException>(() => fs.EnumerateFiles("*", null).First()); Assert.Throws <ArgumentNullException>(() => fs.EnumerateFiles("*", null, SearchOption.AllDirectories).First()); Assert.Throws <ArgumentNullException>(() => fs.EnumerateDirectories("*", null).First()); Assert.Throws <ArgumentNullException>(() => fs.EnumerateDirectories("*", null, SearchOption.AllDirectories).First()); Assert.Throws <ArgumentNullException>(() => fs.EnumerateFileEntries("*", null).First()); Assert.Throws <ArgumentNullException>(() => fs.EnumerateFileEntries("*", null, SearchOption.AllDirectories).First()); Assert.Throws <ArgumentNullException>(() => fs.EnumerateDirectoryEntries("*", null).First()); Assert.Throws <ArgumentNullException>(() => fs.EnumerateDirectoryEntries("*", null, SearchOption.AllDirectories).First()); Assert.Throws <ArgumentNullException>(() => fs.EnumerateFileSystemEntries("*", null).First()); Assert.Throws <ArgumentNullException>(() => fs.EnumerateFileSystemEntries("*", null, SearchOption.AllDirectories).First()); Assert.Throws <FileNotFoundException>(() => fs.GetFileEntry("/a.txt")); Assert.Throws <DirectoryNotFoundException>(() => fs.GetDirectoryEntry("/a")); }