Exemple #1
0
        public void TestMethod2()
        {
            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 = 2, Code = 11, Name = "Peach", Date = new DateTime(2020, 4, 12), Days = 30, Count = 14000, Price = 15
                }
            };

            createFile(tab);

            rd = new RepDat(testpath);

            bool exceptionOccured = false;

            try
            {
                var res = rd.GetProd();
            }
            catch
            {
                exceptionOccured = true;
            }

            if (!exceptionOccured)
            {
                Assert.Fail();
            }
        }
Exemple #2
0
        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();
            }
        }
Exemple #3
0
        public void TestMethod1()
        {
            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 = 2, Code = 12, Name = "Peach", Date = new DateTime(2020, 4, 12), Days = 30, Count = 14000, Price = 15
                },
                new Products {
                    NumWar = 2, Code = 13, Name = "Pineapple", Date = new DateTime(2020, 3, 14), Days = 30, Count = 19000, Price = 8
                },
                new Products {
                    NumWar = 1, Code = 14, Name = "Melon", Date = new DateTime(2020, 3, 15), Days = 30, Count = 11000, Price = 20
                }
            };

            createFile(tab);

            rd = new RepDat(testpath);

            var res = rd.GetProd();

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

            res2.AddRange(res);

            if (!ListsEqual(res2, tab))
            {
                Assert.Fail();
            }
        }
Exemple #4
0
        public void TestMethod3()
        {
            List <Products> tab = new List <Products> {
                new Products {
                    NumWar = 1, Code = 11, Name = "", Date = new DateTime(2020, 4, 10), Days = 30, Count = 12000, Price = 10
                }
            };

            createFile(tab);

            rd = new RepDat(testpath);

            try
            {
                var res = rd.GetProd();
            }
            catch
            {
                Assert.Fail();
            }
        }