コード例 #1
0
        public void TestMethod1_system_failSenrio()
        {
            setUp();
            stubUser stubUser = new stubUser(2, null, null, false, false);

            sys.Users.Add(2, stubUser);

            Assert.AreEqual(false, sys.addProductsToCart(null, store.Id, stubUser.Id));


            List <KeyValuePair <int, int> > toInsert = new List <KeyValuePair <int, int> >();


            Assert.AreEqual(false, sys.addProductsToCart(toInsert, 10, stubUser.Id));
            Assert.AreEqual(false, sys.addProductsToCart(toInsert, store.Id, 10));
            toInsert.Add(new KeyValuePair <int, int>(10, 10));
            Assert.AreEqual(false, sys.addProductsToCart(toInsert, store.Id, stubUser.Id));
        }
コード例 #2
0
        public void TestMethod1_system_successSenrio()
        {
            setUp();
            stubUser stubUser = new stubUser(2, null, null, false, false);

            sys.Users.Add(2, stubUser);


            List <KeyValuePair <int, int> > toInsert = new List <KeyValuePair <int, int> >();

            toInsert.Add(new KeyValuePair <int, int>(p1.Id, 1));
            toInsert.Add(new KeyValuePair <int, int>(p2.Id, 1));
            toInsert.Add(new KeyValuePair <int, int>(p3.Id, 1));
            Assert.AreEqual(false, ((stubUser)sys.Users[stubUser.Id]).Carts_entrys.ContainsKey(store.Id));

            Assert.AreEqual(true, sys.addProductsToCart(toInsert, store.Id, stubUser.Id));

            toInsert = new List <KeyValuePair <int, int> >();
            toInsert.Add(new KeyValuePair <int, int>(p4.Id, 1));

            Assert.AreEqual(true, sys.addProductsToCart(toInsert, store.Id, stubUser.Id));
        }