Пример #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
        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 CoronaAds()
 {
     isActive   = false;
     bannerType = BannerTypes.banner320x48;
     this.size  = new Size(320, 48);
     location   = new Point(0, 0);
     isTestMode = true;
     provider   = AdsProvider.none;
     interval   = 10;
     appId      = "";
 }
Пример #5
0
 public CoronaAds()
 {
     isActive = false;
     bannerType = BannerTypes.banner320x48;
     this.size = new Size(320, 48);
     location = new Point(0, 0);
     isTestMode = true;
     provider = AdsProvider.none;
     interval = 10;
     appId = "";
 }
Пример #6
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);
        }
Пример #7
0
        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);
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
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);
        }
Пример #11
0
    public void SetBannerType(BannerTypes bannerType)
    {
        switch (bannerType)
        {
        case BannerTypes.None:
            BannerBlock.SetActive(false);
            break;

        case BannerTypes.NewCard:
            BannerBlock.SetActive(true);
            LanguageManager.Instance.RegisterTextKey(BannerText, "CardBase_NewCardBanner");
            break;
        }
    }
Пример #12
0
        public static Tag InitializeTag(BannerTypes bannerType)
        {
            switch (bannerType)
            {
            case BannerTypes.Html:
                return(new Html(BannerTypes.Html));

            case BannerTypes.Image:
                return(new Image(BannerTypes.Image));

            case BannerTypes.Video:
                return(new Video(BannerTypes.Video));

            case BannerTypes.Keyword:
                return(new Keyword(BannerTypes.Keyword));

            default:
                throw new NotSupportedException("Banner type is not valid.");
            }
        }
Пример #13
0
 protected Tag(BannerTypes bannerType)
 {
     BannerType = bannerType;
 }
Пример #14
0
 public Keyword(BannerTypes bannerType, TagFormats tagFormat, ServingMethods servingMethod,
                List <string> impressionPixels = null) :
     base(bannerType, tagFormat, servingMethod, impressionPixels)
 {
     _impressionPixels = impressionPixels;
 }
Пример #15
0
 public Keyword(BannerTypes bannerType) : base(bannerType)
 {
 }
Пример #16
0
 public Image(BannerTypes bannerType) : base(bannerType)
 {
 }
Пример #17
0
 public Video(BannerTypes bannerType) : base(bannerType)
 {
 }
Пример #18
0
 public Html(BannerTypes bannerType) : base(bannerType)
 {
 }