Пример #1
0
        public void GetFavouriteSKU_distributor_Call_Received()
        {
            var favorProvider = Substitute.For <IFavouriteSkuLoader>();

            favorProvider.GetDistributorFavouriteSKU("testid", "zh-CN").Returns(favorList);
            FavouriteSKUBLTest fvBL = new FavouriteSKUBLTest(favorProvider);

            fvBL.CheckIfFavouriteSKU("1316", "testid", "zh-CN");
            fvBL.CheckIfFavouriteSKU("1317", "testid", "zh-CN");
            fvBL.CheckIfFavouriteSKU("1318", "testid", "zh-CN");

            favorProvider.Received(3).GetDistributorFavouriteSKU(Arg.Any <string>(), Arg.Any <string>());
        }
Пример #2
0
        public void GetFavouriteSKU_Product_Is_In_FavouriteList()
        {
            var favorProvider = Substitute.For <IFavouriteSkuLoader>();

            favorProvider.GetDistributorFavouriteSKU("testid", "zh-CN").Returns(favorList);
            FavouriteSKUBLTest fvBL = new FavouriteSKUBLTest(favorProvider);

            var result = fvBL.CheckIfFavouriteSKU("1316", "testid", "zh-CN");

            Assert.AreEqual(true, result);

            result = fvBL.CheckIfFavouriteSKU("1317", "testid", "zh-CN");
            Assert.AreNotEqual(true, result);

            //Different distributor id
            result = fvBL.CheckIfFavouriteSKU("1316", "testid2", "zh-CN");
            Assert.AreNotEqual(true, result);

            //no distributor pass in
            result = fvBL.CheckIfFavouriteSKU("1316", string.Empty, "zh-CN");
            Assert.AreNotEqual(true, result);
        }