Exemplo n.º 1
0
        public void getById()
        {
            Cart c = new Cart();

            Product p = new Product() { id = 1, name = "prueba1" };
            c.add(p);

            Assert.AreEqual(c.getById(1).id , p.id);
        }
Exemplo n.º 2
0
        public void add()
        {
            Cart c = new Cart();

            Product p = new Product() { id = 1  , name = "prueba1" };

            Assert.IsTrue(c.add(p));
            Assert.IsNotNull(c.getById(p.id));
        }
Exemplo n.º 3
0
        public void remove_complete()
        {
            Cart c = new Cart();

            Product p = new Product() { id = 1, name = "prueba1" };
            c.add(p);

            Assert.IsTrue(c.remove(p.id));
            Assert.IsNull(c.getById(p.id));
        }
Exemplo n.º 4
0
        public void remove_1()
        {
            Cart c = new Cart();

            Product p = new Product() { id = 1, name = "prueba1" };
            c.add(p);
            c.add(p);

            Assert.IsTrue(c.remove(p.id));
            Assert.AreEqual(c.getById(p.id).quantity , 1);
        }
Exemplo n.º 5
0
        public void getById_null()
        {
            Cart c = new Cart();

            Assert.IsNull(c.getById(0));
        }
Exemplo n.º 6
0
        public void remove_empty()
        {
            Cart c = new Cart();

            Assert.IsFalse(c.remove(0));
            Assert.IsNull(c.getById(0));
        }