public void AddFile_FileNotExists_AddsFile() { var path = "test.html"; var content = Encoding.ASCII.GetBytes("content"); var dictionary = new Dictionary <string, byte[]>(); var testee = new DictionaryZipWrapper(dictionary); testee.AddFile(path, content); var result = dictionary[path]; Assert.AreEqual(content, result); }
public void DeleteFile_FileExists_DeletesFile() { var path = "test.html"; var content = Encoding.ASCII.GetBytes("content"); var dictionary = new Dictionary <string, byte[]> { { path, content } }; var testee = new DictionaryZipWrapper(dictionary); testee.DeleteFile(path); Assert.IsFalse(dictionary.Any()); }
public void GetFileContent_WithFileExists_ReturnsFile() { var path = "test.html"; var content = Encoding.ASCII.GetBytes("content"); var dictionary = new Dictionary <string, byte[]> { { path, content } }; var testee = new DictionaryZipWrapper(dictionary); var result = testee.GetFileContent(path); Assert.AreEqual(content, result); }
public void EnumerateFiles_FileExists_EnumeratesFiles() { var path = "test.html"; var content = Encoding.ASCII.GetBytes("content"); var dictionary = new Dictionary <string, byte[]> { { path, content } }; var testee = new DictionaryZipWrapper(dictionary); var result = testee.EnumerateFiles().Single(); Assert.AreEqual(result.Item1, path); Assert.AreEqual(result.Item2, content); }
public void GetFileStream_WithFileExists_ReturnsStream() { var path = "test.html"; var content = Encoding.ASCII.GetBytes("content"); var dictionary = new Dictionary <string, byte[]> { { path, content } }; var testee = new DictionaryZipWrapper(dictionary); using var reader = new BinaryReader(testee.GetFileStream(path)); var result = reader.ReadBytes(content.Length); CollectionAssert.AreEqual(content, result); }