Bläddra i källkod

Added ReadMultipleSheets

Piotr Czajkowski 1 år sedan
förälder
incheckning
772c903777

+ 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