public void TestMethodB() { List <Products> tab = new List <Products> { new Products { NumWar = 1, Code = 11, Name = "Apple", Date = new DateTime(2020, 4, 10), Days = 30, Count = 12000, Price = 10 }, new Products { NumWar = 1, Code = 12, Name = "Peach", Date = new DateTime(2020, 4, 12), Days = 30, Count = 14000, Price = 15 } }; createFile(tab); rd = new RepDat(testpath); bool exceptionOccured = false; try { rd.Del("Ildar"); } catch { exceptionOccured = true; } if (!exceptionOccured) { Assert.Fail(); } }
public void TestMethodA() { List <Products> tab = new List <Products> { new Products { NumWar = 1, Code = 11, Name = "Apple", Date = new DateTime(2020, 4, 10), Days = 30, Count = 12000, Price = 10 }, new Products { NumWar = 1, Code = 12, Name = "Peach", Date = new DateTime(2020, 4, 12), Days = 30, Count = 14000, Price = 15 } }; createFile(tab); List <Products> expected = tab; rd = new RepDat(testpath); try { rd.Del("45"); List <Products> res = new List <Products>(); res.AddRange(rd.GetProd()); if (!ListsEqual(res, expected)) { Assert.Fail(); } } catch { Assert.Fail(); } }