File size: 1,510 Bytes
fab29d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
using VersOne.Epub.Environment;
namespace VersOne.Epub.Test.Unit.Mocks
{
internal class TestFileSystem : IFileSystem
{
private readonly Dictionary<string, TestZipFile> testZipFilesByPath;
private readonly Dictionary<Stream, TestZipFile> testZipFilesByStream;
public TestFileSystem()
{
testZipFilesByPath = new Dictionary<string, TestZipFile>();
testZipFilesByStream = new Dictionary<Stream, TestZipFile>();
}
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];
}
}
}
|