示例#1
0
        public void AddFavouriteSKU_to_FavouriteList()
        {
            var favorProvider = Substitute.For <IFavouriteSkuLoader>();

            favorProvider.SetFavouriteSKU("testid", 1, "1316", "zh-CN", 0).Returns(true);
            FavouriteSKUBLTest fvBL = new FavouriteSKUBLTest(favorProvider);

            //Add Favourite List
            var result = fvBL.AddFavouriteSKUtoList("testid", 1, "1316", "zh-CN", 0);

            Assert.AreEqual(true, result);

            //Remove Favourite List
            favorProvider.SetFavouriteSKU("testid", 1, "1316", "zh-CN", 1).Returns(true);
            fvBL = new FavouriteSKUBLTest(favorProvider);
            Assert.AreEqual(true, result);
        }
示例#2
0
        public void AddRemoveFavouriteSKU_to_FavouriteList_Received()
        {
            var favorProvider = Substitute.For <IFavouriteSkuLoader>();

            favorProvider.SetFavouriteSKU("testid", 1, "1316", "zh-CN", 0).Returns(true);
            FavouriteSKUBLTest fvBL = new FavouriteSKUBLTest(favorProvider);

            fvBL.AddFavouriteSKUtoList("testid", 1, "1316", "zh-CN", 0);
            fvBL.AddFavouriteSKUtoList("testid", 2, "1317", "zh-CN", 0);
            fvBL.AddFavouriteSKUtoList("testid", 3, "1318", "zh-CN", 0);

            fvBL.AddFavouriteSKUtoList("testid", 1, "1316", "zh-CN", 1);
            fvBL.AddFavouriteSKUtoList("testid", 2, "1317", "zh-CN", 1);
            fvBL.AddFavouriteSKUtoList("testid", 3, "1318", "zh-CN", 1);

            favorProvider.Received(6).SetFavouriteSKU(Arg.Any <string>(), Arg.Any <int>(), Arg.Any <string>(), Arg.Any <string>(), Arg.Any <int>());
        }