|
@@ -1,3 +1,4 @@
|
|
|
+using ClosedXML.Excel;
|
|
|
using ExcelORM;
|
|
|
|
|
|
namespace ExcelORMTests;
|
|
@@ -54,4 +55,23 @@ public class DynamicWriterTests
|
|
|
|
|
|
File.Delete(testFile);
|
|
|
}
|
|
|
+
|
|
|
+ [Fact]
|
|
|
+ public void WriteReadInMemory()
|
|
|
+ {
|
|
|
+ using var readWorkbook = new XLWorkbook(DifficultFile);
|
|
|
+ var reader = new ExcelDynamicReader(readWorkbook);
|
|
|
+ var results = reader.Read().ToArray();
|
|
|
+ Assert.NotEmpty(results);
|
|
|
+
|
|
|
+ using var writeWorkbook = new XLWorkbook();
|
|
|
+ var writer = new ExcelDynamicWriter(writeWorkbook);
|
|
|
+ writer.Write(results);
|
|
|
+
|
|
|
+ var savedReader = new ExcelDynamicReader(writeWorkbook);
|
|
|
+ var savedResults = savedReader.Read().ToArray();
|
|
|
+ Assert.NotEmpty(savedResults);
|
|
|
+ Assert.True(results.First().SequenceEqual(savedResults.First()));
|
|
|
+ Assert.True(results.Last().SequenceEqual(savedResults.Last()));
|
|
|
+ }
|
|
|
}
|