示例#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);
        }
示例#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));
        }
示例#3
0
        public void add_empty()
        {
            Cart c = new Cart();

            Product p = new Product();

            bool result = c.add(p);

            Assert.IsFalse(result);
        }
示例#4
0
        public void get()
        {
            Cart c = new Cart();

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

            Product q = c.get().First();

            Assert.AreEqual(q.id, p.id);
        }
示例#5
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));
        }
示例#6
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);
        }