public void FileResourceExporter_WhenExportingSmallerStream_ExpectFileLengthToMatchStreamLength() { const string filePath = "eightbytes.bin"; var sut = new FileResourceExporter <MemoryStream>(new FileResourceService()); using (var stream = new MemoryStream(_fourBytes)) { sut.Export(stream, filePath); } var importer = new FileResourceImporter <MemoryStream>(new FileResourceService()); var result = importer.Import(filePath); Assert.IsTrue(result.Length == _fourBytes.Length); }
public void FileResourceExporter_WhenExportingSmallerStream_ExpectFileByteSequenceToMatchStreamByteSequence() { const string filePath = "eightbytes.bin"; var sut = new FileResourceExporter <MemoryStream>(new FileResourceService()); using (var stream = new MemoryStream(_fourBytes)) { sut.Export(stream, filePath); } var importer = new FileResourceImporter <MemoryStream>(new FileResourceService()); var result = importer.Import(filePath); var buffer = new byte[_fourBytes.Length]; var _ = result.Read(buffer, 0, _fourBytes.Length); Assert.IsTrue(_fourBytes.SequenceEqual(buffer)); }
public void FileResourceExporter_WhenExportingAndFilePathIsWhitespace_ExpectArgumentException() { var sut = new FileResourceExporter <MemoryStream>(new FileResourceService()); sut.Export(new MemoryStream(), " "); }
public void FileResourceExporter_WhenExportingAndFilePathIsEmpty_ExpectArgumentException() { var sut = new FileResourceExporter <MemoryStream>(new FileResourceService()); sut.Export(new MemoryStream(), string.Empty); }
public void FileResourceExporter_WhenExportingAndStreamIsNull_ExpectArgumentNullException() { var sut = new FileResourceExporter <MemoryStream>(new FileResourceService()); sut.Export(null, "test"); }