示例#1
0
        public void GetBannerSettings()
        {
            GivenServiceLocator();
            GivenBannerController();

            WhenAddTemplate();
            WhenAddBanner("Template1", "Mother Day", "SaltedChicken");
            WhenAddBanner("Template1", "Father Day", "Squid");
            WhenAddResx();

            var banners = _bannerController.GetBannerSettings(new GetBannersSettingReq()
            {
                TemplateName = "Template1"
            });

            new BannerVariable
            {
                VarName  = "image",
                VarType  = "Image(100,200)",
                ResxName = "SaltedChickenPizzaImage",
                ResxList = new List <VariableResx>(new[]
                {
                    new VariableResx {
                        IsoLangCode = "en-US", Content = "English Salted Chicken Pizza Url"
                    },
                    new VariableResx {
                        IsoLangCode = "zh-TW", Content = "鹹酥雞披薩圖片連結"
                    },
                })
            }.ToExpectedObject()
            .ShouldEqual(banners[0].Variables[0]);

            new BannerVariable
            {
                VarName  = "title",
                VarType  = "String",
                ResxName = "SaltedChickenPizzaTitle",
                ResxList = new List <VariableResx>(new[]
                {
                    new VariableResx {
                        IsoLangCode = "en-US", Content = "Salted Chicken Pizza"
                    },
                })
            }
            .ToExpectedObject()
            .ShouldEqual(banners[0].Variables[1]);

            new BannerVariable
            {
                VarName  = "image",
                VarType  = "Image(100,200)",
                ResxName = "SquidPizzaImage",
                ResxList = new List <VariableResx>(new[]
                {
                    new VariableResx {
                        IsoLangCode = "en-US", Content = "English Squid Pizza Url"
                    },
                })
            }.ToExpectedObject()
            .ShouldEqual(banners[1].Variables[0]);
        }