소스 검색

Added ReadMultipleSheets

Piotr Czajkowski 1 년 전
부모
커밋
772c903777
3개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      ExcelORM/ExcelORMTests/ExcelORMTests.csproj
  2. 10 0
      ExcelORM/ExcelORMTests/ReaderTests.cs
  3. BIN
      ExcelORM/ExcelORMTests/testFiles/multipleSheets.xlsx

+ 3 - 0
ExcelORM/ExcelORMTests/ExcelORMTests.csproj

@@ -39,6 +39,9 @@
       <None Update="testFiles\columnsOnTheLeftHeaderNotFirstRow.xlsx">
         <CopyToOutputDirectory>Always</CopyToOutputDirectory>
       </None>
+      <None Update="testFiles\multipleSheets.xlsx">
+        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      </None>
     </ItemGroup>
 
     <ItemGroup>

+ 10 - 0
ExcelORM/ExcelORMTests/ReaderTests.cs

@@ -8,6 +8,7 @@ public class ReaderTests
     private const string HiddenFile = "testFiles/hidden.xlsx";
     private const string FilteredFile = "testFiles/filtered.xlsx";
     private const string DifficultFile = "testFiles/columnsOnTheLeftHeaderNotFirstRow.xlsx";
+    private const string MultipleSheetsFile = "testFiles/multipleSheets.xlsx";
     
     [Fact]
     public void Read()
@@ -50,4 +51,13 @@ public class ReaderTests
         var results = reader.Read<Test>().ToArray();
         Assert.NotEmpty(results);
     }
+    
+    [Fact]
+    public void ReadMultipleSheets()
+    {
+        var reader = new ExcelReader(MultipleSheetsFile);
+        var results = reader.Read<Test>().ToArray();
+        Assert.NotEmpty(results);
+        Assert.Equal(6, results.Length);
+    }
 }

BIN
ExcelORM/ExcelORMTests/testFiles/multipleSheets.xlsx