소스 검색

Added WriteReadInMemory

Piotr Czajkowski 3 달 전
부모
커밋
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]);
+    }
 }