public void WrittenStreamIsCorrectlyConverted()
        {
            var stream = new MemoryStream();

            stream.Write(new byte[] { 1, 2, 3 }, 0, 3);

            var file = InMemoryFileFactory.CreateFromStream(stream);

            file.GetData().Length.Should().Be(3);
        }
示例#2
0
        public IInMemoryFile WriteExcel(string fileName, string contentType = null)
        {
            this.CheckWorkbook();

            var memoryStream = new MemoryStream();

            this.workbook.Write(memoryStream);
            var memoryStream2 = new MemoryStream(memoryStream.ToArray());

            return(InMemoryFileFactory.CreateFromStream(memoryStream2, $"{fileName}.xlsx", contentType));
        }