Ejemplo n.º 1
0
        public void TestRead()
        {
            var parser = new ReportDtoParser();
            var file   = GetSampleFile("Fillreport.xlsx");

            using (var stream = File.OpenRead(file)) {
                var result = parser.Read(stream);
                Assert.NotNull(result);
                Assert.NotEmpty(result);
                Assert.Equal(16, result.Count());
                Assert.True(parser.ParseResult.IsValid);
            }
        }
Ejemplo n.º 2
0
        public void TestTryReadSheet()
        {
            var  parser  = new ReportDtoParser();
            var  file    = GetSampleFile("Fillreport.xlsx");
            bool hasData = false;

            using (var reader = ExcelReaderFactory.CreateReader(File.OpenRead(file))) {
                do
                {
                    if (parser.TryReadSheet(reader, out var values))
                    {
                        Assert.NotEmpty(values);
                        hasData = true;
                    }
                } while (reader.NextResult());
            }
            Assert.True(hasData);
        }