public void IgnoreTest() { var excel = new ExcelMapper(@"..\..\..\products.xlsx"); excel.Ignore <IgnoreProduct>(p => p.Price); var products = excel.Fetch <IgnoreProduct>().ToList(); var nudossi = products[0]; Assert.AreEqual("Nudossi", nudossi.Name); Assert.AreEqual(0, nudossi.Number); Assert.AreEqual(0m, nudossi.Price); Assert.IsFalse(nudossi.Offer); var halloren = products[1]; Assert.IsTrue(halloren.Offer); Assert.AreEqual(new DateTime(2015, 12, 31), halloren.OfferEnd); var file = "productsignored.xlsx"; new ExcelMapper().Save(file, products, "Products"); var productsFetched = new ExcelMapper(file).Fetch <IgnoreProduct>().ToList(); CollectionAssert.AreEqual(products, productsFetched); }
public void IgnoreTest() { var excel = new ExcelMapper(@"..\..\products.xlsx"); excel.Ignore<IgnoreProduct>(p => p.Price); var products = excel.Fetch<IgnoreProduct>().ToList(); var nudossi = products[0]; Assert.AreEqual("Nudossi", nudossi.Name); Assert.AreEqual(0, nudossi.Number); Assert.AreEqual(0m, nudossi.Price); Assert.IsFalse(nudossi.Offer); var halloren = products[1]; Assert.IsTrue(halloren.Offer); Assert.AreEqual(new DateTime(2015, 12, 31), halloren.OfferEnd); var file = "productsignored.xlsx"; new ExcelMapper().Save(file, products, "Products"); var productsFetched = new ExcelMapper(file).Fetch<IgnoreProduct>().ToList(); CollectionAssert.AreEqual(products, productsFetched); }