コード例 #1
0
 protected Tag(BannerTypes bannerType, TagFormats tagFormat, ServingMethods servingMethod, List <string> impressionPixels = null)
 {
     BannerType       = bannerType;
     TagFormat        = tagFormat;
     ServingMethod    = servingMethod;
     ImpressionPixels = impressionPixels;
 }
コード例 #2
0
        public void CreateTagWithInvalidSettings()
        {
            const BannerTypes    bannerType    = BannerTypes.Video;
            const TagFormats     tagFormat     = TagFormats.JavaScriptDefault;
            const ServingMethods servingMethod = ServingMethods.Clicks;

            var ex = Assert.Throws <Exception>(() => TagService.CreateTag(bannerType, tagFormat, servingMethod));

            Assert.Equal("This tag format is not valid for this banner type.", ex.Message);
        }
コード例 #3
0
ファイル: TagService.cs プロジェクト: dainiusbratkauskas/Task
        public static Tag CreateTag(BannerTypes bannerType, TagFormats tagFormat, ServingMethods servingMethod,
                                    List <string> impressionPixels = null)
        {
            var tag = TagFactory.InitializeTag(bannerType);

            tag.TagFormat        = tagFormat;
            tag.ServingMethod    = servingMethod;
            tag.ImpressionPixels = impressionPixels;
            return(tag);
        }
コード例 #4
0
        public void EditTagWithInvalidSettings()
        {
            const BannerTypes    bannerType    = BannerTypes.Video;
            const TagFormats     tagFormat     = TagFormats.UrlToXml;
            const ServingMethods servingMethod = ServingMethods.Impressions;

            var videoTag = new Video(BannerTypes.Video, TagFormats.UrlToXml, ServingMethods.Xml);

            var ex = Assert.Throws <Exception>(() => TagService.SetTag(videoTag, bannerType, tagFormat, servingMethod));

            Assert.Equal("This serving method is not valid for this banner type.", ex.Message);
        }
コード例 #5
0
        public void CreateValidTag()
        {
            const BannerTypes    bannerType    = BannerTypes.Html;
            const TagFormats     tagFormat     = TagFormats.Iframe;
            const ServingMethods servingMethod = ServingMethods.Impressions;

            var newTag = TagService.CreateTag(bannerType, tagFormat, servingMethod);

            Assert.Equal(bannerType, newTag.BannerType);
            Assert.Equal(servingMethod, newTag.ServingMethod);
            Assert.Equal(tagFormat, newTag.TagFormat);
        }
コード例 #6
0
        public void EditValidTagSettings()
        {
            const BannerTypes    bannerType    = BannerTypes.Image;
            const TagFormats     tagFormat     = TagFormats.JavaScriptDefault;
            const ServingMethods servingMethod = ServingMethods.Clicks;

            var tag        = new Image(bannerType, TagFormats.Iframe, ServingMethods.Impressions);
            var updatedTag = TagService.SetTag(tag, bannerType, tagFormat, servingMethod);

            Assert.Equal(bannerType, updatedTag.BannerType);
            Assert.Equal(servingMethod, updatedTag.ServingMethod);
            Assert.Equal(tagFormat, updatedTag.TagFormat);
        }
コード例 #7
0
        public void EditValidTagType()
        {
            const BannerTypes    bannerType    = BannerTypes.Html;
            const TagFormats     tagFormat     = TagFormats.JavaScriptDefault;
            const ServingMethods servingMethod = ServingMethods.Clicks;

            var imageTag = new Image(BannerTypes.Image, TagFormats.Iframe, ServingMethods.Impressions);

            var tag = TagService.SetTag(imageTag, bannerType, tagFormat, servingMethod);

            Assert.Equal(bannerType, tag.BannerType);
            Assert.Equal(servingMethod, tag.ServingMethod);
            Assert.Equal(BannerTypes.Html, BannerTypes.Html);
        }
コード例 #8
0
ファイル: Keyword.cs プロジェクト: dainiusbratkauskas/Task
 public Keyword(BannerTypes bannerType, TagFormats tagFormat, ServingMethods servingMethod,
                List <string> impressionPixels = null) :
     base(bannerType, tagFormat, servingMethod, impressionPixels)
 {
     _impressionPixels = impressionPixels;
 }
コード例 #9
0
 /// <summary>
 /// Overrides default serving method
 /// </summary>
 /// <param name="methods">the new default serving method for all services</param>
 /// <param name="override">if true, serving methods for [Service] calsses are overridden with the specified one</param>
 /// <returns>the modified settings</returns>
 public InjectionOptions ServingMethod(ServingMethods methods, bool @override = false)
 {
     this._servingMethod         = methods;
     this._overrideServingMethod = @override;
     return(this);
 }
コード例 #10
0
ファイル: TagService.cs プロジェクト: dainiusbratkauskas/Task
        public static Tag SetTag(Tag tag, BannerTypes bannerType, TagFormats tagFormat, ServingMethods servingMethod, List <string> impressionPixels = null)
        {
            if (tag.BannerType != bannerType)
            {
                tag = TagFactory.InitializeTag(bannerType);
            }
            tag.TagFormat        = tagFormat;
            tag.ServingMethod    = servingMethod;
            tag.ImpressionPixels = impressionPixels;

            return(tag);
        }