public void FetchTest() { var excelMapper = new ExcelMapper(@"..\..\..\products.xlsx"); var headers = excelMapper.GetHeders(); Assert.AreEqual(headers.Length, 8); foreach (var item in excelMapper.Fetch <Product>()) { var cell = excelMapper.CurrentRow.GetCell(headers.ToList().IndexOf(headers[1])); var value = cell.StringCellValue; Assert.IsNotEmpty(value); } var products = excelMapper.Fetch <Product>(); CollectionAssert.AreEqual(new List <Product> { new Product { Name = "Nudossi", NumberInStock = 60, Price = 1.99m, Value = "C2*D2" }, new Product { Name = "Halloren", NumberInStock = 33, Price = 2.99m, Value = "C3*D3" }, new Product { Name = "Filinchen", NumberInStock = 100, Price = 0.99m, Value = "C5*D5" }, }, products); }
public void TestExcel() { var excelMapper = new ExcelMapper(@"..\..\..\1.xlsx"); var list = new List <ConfigData>(); var headers = excelMapper.GetHeders(); foreach (var item in excelMapper.Fetch <ConfigData>()) { list.Add(item); } }