Piotr Czajkowski 3 месяцев назад
Родитель
Сommit
357260d4a2
1 измененных файлов с 16 добавлено и 0 удалено
  1. 16 0
      ExcelORM/ExcelORMTests/WriterTests.cs

+ 16 - 0
ExcelORM/ExcelORMTests/WriterTests.cs

@@ -300,4 +300,20 @@ public class WriterTests
         
         File.Delete(testFile);
     }
+
+    [Fact]
+    public void WriteReadInMemory()
+    {
+        using var workbook = new XLWorkbook();
+        const string worksheetName = "Test";
+        var writer = new ExcelWriter(workbook);
+        writer.Write(arrayOfThree, worksheetName);
+
+        var reader = new ExcelReader(workbook);
+        var readArray = reader.Read<Test>(worksheetName).ToArray();
+        Assert.Equal(3, readArray.Length);
+
+        for (int i = 0; i < readArray.Length; i++)
+            Assert.Equal(arrayOfThree[i], readArray[i]);
+    }
 }