public void ReadTextFile_path_to_directory_throws_FileExpectedException() { var fileSystemMock = new MockCommonFileSystemReadFile(); fileSystemMock.SetPathExistance(_testPath, MockCommonFileSystem.PathExistance.Directory); fileSystemMock.ReadTextFile(_testPath, null); }
public void ReadTextFile_path_to_file_returns_contents_using_non_default_encoding() { var data = "Booga, \u1234\u2345"; var fileSystemMock = new MockCommonFileSystemReadFile(); fileSystemMock.SetPathExistance(_testPath, MockCommonFileSystem.PathExistance.File); fileSystemMock.DataToReturn = Encoding.UTF32.GetBytes(data); var result = fileSystemMock.ReadTextFile(_testPath, Encoding.UTF32); Assert.That(fileSystemMock.Called); AssertPath(fileSystemMock.Path); Assert.AreEqual(data, result); }
public void ReadBinaryFile_path_to_file_returns_contents() { var data = new byte[] { 1, 2, 3, 4, 5, 6 }; var fileSystemMock = new MockCommonFileSystemReadFile(); fileSystemMock.SetPathExistance(_testPath, MockCommonFileSystem.PathExistance.File); fileSystemMock.DataToReturn = data; var result = fileSystemMock.ReadBinaryFile(_testPath); Assert.That(fileSystemMock.Called); AssertPath(fileSystemMock.Path); Assert.AreEqual(data, result); }