public void TestMethod8() { 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 } }; createFile(tab); rd = new RepDat(testpath); bool exceptionOccured = false; try { rd.Add("Ildar", "Ogorodnik", "45", new DateTime(2020, 4, 10).ToString("yyyy.MM.dd"), "LoL", "KeK", "ChebureK"); } catch { exceptionOccured = true; } if (!exceptionOccured) { Assert.Fail(); } }
public void TestMethod7() { 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 } }; createFile(tab); rd = new RepDat(testpath); List <Products> expected = new List <Products> { new Products { NumWar = 1, Code = 12, Name = "Peach", Date = new DateTime(2020, 4, 10), Days = 35, Count = 50, Price = 10 } }; try { rd.Add("12", "1", "Peach", new DateTime(2020, 4, 10).ToString("yyyy.MM.dd"), "35", "50", "10"); List <Products> res = new List <Products>(); res.AddRange(rd.Search("", "12", "", "")); if (!ListsEqual(res, expected)) { Assert.Fail(); } } catch { Assert.Fail(); } }