Piotr Czajkowski 2 месяцев назад
Родитель
Сommit
f05d82254d

+ 3 - 0
ExcelORM/ExcelORMTests/ExcelORMTests.csproj

@@ -53,6 +53,9 @@
       <None Update="testFiles\withFormula.xlsx">
         <CopyToOutputDirectory>Always</CopyToOutputDirectory>
       </None>
+      <None Update="testFiles\badDate.xlsx">
+        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      </None>
     </ItemGroup>
 
     <ItemGroup>

+ 8 - 0
ExcelORM/ExcelORMTests/ReaderTests.cs

@@ -11,6 +11,7 @@ public class ReaderTests
     private const string MultipleSheetsFile = "testFiles/multipleSheets.xlsx";
     private const string DifferentTypesFile = "testFiles/differentTypes.xlsx";
     private const string WithFormulaFile = "testFiles/withFormula.xlsx";
+    private const string BadDate = "testFiles/badDate.xlsx";
     
     [Fact]
     public void Read()
@@ -109,4 +110,11 @@ public class ReaderTests
         var results = reader.Read<TestWithFormula>().ToArray();
         Assert.NotEmpty(results);
     }
+    
+    [Fact]
+    public void BadDateThrows()
+    {
+        using var reader = new ExcelReader(BadDate);
+        Assert.Throws<ArgumentException>(() => reader.Read<TestTypes>().ToArray());
+    }
 }

BIN
ExcelORM/ExcelORMTests/testFiles/badDate.xlsx