Exemplo n.º 1
0
        public void GeenProductenMetAantal0()
        {
            int    expected = 1;
            int    a        = 0;
            string aantal   = a.ToString();

            List <SaleLinesItem> testproductdb = new List <SaleLinesItem>();
            ProductInformatie    product1      = new ProductInformatie("testitem1", "testbeschrijving1", 10.00f, "Fysiek", "");

            testproductdb.Add(new SaleLinesItem("1", product1));

            ProductInformatie product2 = new ProductInformatie("testitem2", "testbeschrijving2", 10.00f, "Fysiek", "");
            winkelmand        w        = new winkelmand();

            w.productdb = testproductdb;
            w.addtocart(aantal, product2);

            int actual = w.productdb.Count;

            Assert.AreEqual(expected, actual, 0.001, "Product is toegevoegd. test failed");
        }
Exemplo n.º 2
0
        public void TestAantalGelijkeProducten()
        {
            int    expected = 5;
            int    a        = 2;
            string aantal   = a.ToString();
            int    b        = 3;
            string aantal2  = b.ToString();

            List <SaleLinesItem> testproductdb = new List <SaleLinesItem>();
            ProductInformatie    product1      = new ProductInformatie("testitem1", "testbeschrijving1", 10.00f, "Fysiek", "");

            winkelmand w = new winkelmand();

            w.productdb = testproductdb;
            w.addtocart(aantal, product1);
            w.addtocart(aantal2, product1);

            int actual = int.Parse(testproductdb.Find(x => x.productnaam.Contains(product1.titel)).aantal);

            Assert.AreEqual(expected, actual, 0.001, "Aantal producten is onjuist. test failed");
        }