Ejemplo n.º 1
0
        public void GetAdGroups()
        {
            // Assert
            CampaignLo campaignDto = new CampaignLo
            {
                Name      = DateTime.Now.ToString(),
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now.AddYears(1),
                Budget    = new BudgetLo
                {
                    Name        = DateTime.Now.ToString(),
                    MicroAmount = 5000000
                }
            };
            var campaign = Campaigns.CreateCampaign(new AdWordsUser(), campaignDto);

            AdGroupLo adGroupDtoLo = new AdGroupLo
            {
                CampaignId = campaign.value[0].id,
                Name       = DateTime.Now.ToString(),
                KeyWords   = "hej, med dig"
            };

            // Act
            var adGroup = AdGroupAdwords.CreateAdGroup(new AdWordsUser(), adGroupDtoLo);
            var result  = AdGroupAdwords.GetAdGroups(new AdWordsUser(), campaign.value[0].id);

            // Assert
            Assert.AreNotEqual(0, result.Count);
            Assert.AreEqual(adGroup.value[0].name, result.ElementAt(0).name);
        }
Ejemplo n.º 2
0
        public void CreateAdGroupTest()
        {
            // Assert
            CampaignLo campaignDto = new CampaignLo
            {
                Name      = DateTime.Now.ToString(),
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now.AddYears(1),
                Budget    = new BudgetLo
                {
                    Name        = DateTime.Now.ToString(),
                    MicroAmount = 5000000
                }
            };
            var campaign = Campaigns.CreateCampaign(new AdWordsUser(), campaignDto);

            AdGroupLo adGroupDto = new AdGroupLo
            {
                CampaignId = campaign.value[0].id,
                Name       = DateTime.Now.ToString(),
                KeyWords   = "hej, med dig"
            };

            // Act
            var result = AdGroupAdwords.CreateAdGroup(new AdWordsUser(), adGroupDto);

            // Assert
            Assert.AreEqual(adGroupDto.CampaignId, result.value[0].campaignId);
            Assert.AreEqual(2, (int)result.value[0].status);
        }
Ejemplo n.º 3
0
        public void AddKeyWordsToAdGroup()
        {
            CampaignLo campaignDto = new CampaignLo
            {
                Name      = DateTime.Now.ToString(),
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now.AddYears(1),
                Budget    = new BudgetLo
                {
                    Name        = DateTime.Now.ToString(),
                    MicroAmount = 5000000
                }
            };
            var campaign = Campaigns.CreateCampaign(new AdWordsUser(), campaignDto);

            AdGroupLo adGroupDotLo = new AdGroupLo
            {
                CampaignId = campaign.value[0].id,
                Name       = DateTime.Now.ToString(),
                KeyWords   = "hej, med dig"
            };
            var addedAdGroup = AdGroupAdwords.CreateAdGroup(new AdWordsUser(), adGroupDotLo);

            // Act
            var result = AdWordsKeyword.AddKeyWordsToAdGroup(new AdWordsUser(), addedAdGroup.value[0].id, adGroupDotLo.KeyWords);

            // Assert
            Assert.AreEqual(2, result.value.Length);
        }
Ejemplo n.º 4
0
        public void AddAds()
        {
            // Assert
            CampaignLo campaignDto = new CampaignLo
            {
                Name      = DateTime.Now.ToString(),
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now.AddYears(1),
                Budget    = new BudgetLo
                {
                    Name        = DateTime.Now.ToString(),
                    MicroAmount = 5000000
                }
            };
            var campaign = Campaigns.CreateCampaign(new AdWordsUser(), campaignDto);

            AdGroupLo adGroupDto = new AdGroupLo
            {
                CampaignId = campaign.value[0].id,
                Name       = DateTime.Now.ToString(),
                KeyWords   = "hej, med dig"
            };
            var adGroup = AdGroupAdwords.CreateAdGroup(new AdWordsUser(), adGroupDto);

            AdWordsContentLo adsContent = new AdWordsContentLo
            {
                AdGroupLo = new AdGroupLo
                {
                    AdGroupId = adGroup.value[0].id,
                    Name      = adGroup.value[0].name
                },
                ContentProducts = new List <ProductItemLo>
                {
                    new ProductItemLo
                    {
                        AdContent = new AdContentLo
                        {
                            HeadLinePart1 = "Overskrift1",
                            HeadLinePart2 = "Overskrift2",
                            Description   = "Beksrivelse"
                        },
                        FinalUrl = new string[] { "http://nolleren.org/test" }
                    }
                }
            };

            // Act
            var result = ExpandedTextAds.CreateTextAds(new AdWordsUser(), adsContent);

            // Assert
            Assert.AreEqual(adGroup.value[0].id, result.value[0].adGroupId);
            Assert.AreNotEqual(0, result.value.Length);
        }