using VersOne.Epub.Environment; namespace VersOne.Epub.Test.Unit.Mocks { internal class TestFileSystem : IFileSystem { private readonly Dictionary testZipFilesByPath; private readonly Dictionary testZipFilesByStream; public TestFileSystem() { testZipFilesByPath = new Dictionary(); testZipFilesByStream = new Dictionary(); } public TestFileSystem(string epubFilePath, TestZipFile testEpubFile) : this() { AddTestZipFile(epubFilePath, testEpubFile); } public TestFileSystem(Stream epubFileStream, TestZipFile testEpubFile) : this() { AddTestZipFile(epubFileStream, testEpubFile); } public void AddTestZipFile(string path, TestZipFile testZipFile) { testZipFilesByPath.Add(path, testZipFile); } public void AddTestZipFile(Stream stream, TestZipFile testZipFile) { testZipFilesByStream.Add(stream, testZipFile); } public bool FileExists(string path) { return testZipFilesByPath.ContainsKey(path); } public IZipFile OpenZipFile(string path) { return testZipFilesByPath[path]; } public IZipFile OpenZipFile(Stream stream) { return testZipFilesByStream[stream]; } } }