Ejemplo n.º 1
0
        public void TestMethod6()
        {
            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);

            List <Products> expected = new List <Products>();

            bool exceptionOccured = false;

            try
            {
                List <Products> res = new List <Products>();

                res.AddRange(rd.Search("", "Ildar", "", ""));
            }
            catch
            {
                exceptionOccured = true;
            }

            if (!exceptionOccured)
            {
                Assert.Fail();
            }
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
        public void TestMethod5()
        {
            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);

            List <Products> expected = new List <Products>();

            try
            {
                List <Products> res = new List <Products>();

                res.AddRange(rd.Search("", "45", "", ""));

                if (!ListsEqual(res, expected))
                {
                    Assert.Fail();
                }
            }
            catch
            {
                Assert.Fail();
            }
        }