public void UpdatePushCreative()
        {
            PushAdCreative creative = PushAdCreative.Create(15491UL, 16690UL, 30654UL, 100UL, new AdAction(0U));

            creative.Name      = "PushCreative测试1111111111111";
            creative.AdType    = AdTypes.Text;
            creative.TargetUrl = "http://www.adsage.com?channel=apn";
            creative.Content   = "{\"title\":\"标题\", \"text1\":\"第一行文字\",\"text2\" : \"第二行文字\" , \"icon\":\"http://xxx.png\", \"displayurl\":\"http://www.adsage.com\",}";
            DateTime dateTime = new DateTime(2013, 8, 31, 23, 59, 59);

            creative.ExpireDate       = dateTime;
            creative.Monitor          = "{\"imp\" : [\"http://trc.adsage.com/i.gif\",\"http://trc.adsage.com/i2.gif\"],\"click\" : [\"http://trc.adsage.com/i.gif\",\"http://trc.adsage.com/i2.gif\"],\"imp_lpg\":[],\"cli_lpg\":[],\"down\":[],\"install\":[]}";
            creative.Status           = AdStatus.Launching;
            creative.Ext              = "{\"template\" : \"http://xxx.xml\",\"displaytype\" : 1,\"cache_item\" : [\"ext.template\", \"content.icon\"], \"layouttype\" : 2,\"preload\" : 1,\"packagename\" : \"com.soqu.demo\",\"isautoopen\" : 1,\"impfilter\" : 1,\"priority\":210,}";
            creative.Size.ImageSizeId = 0;

            _adPushCreativeData = ConverterFactory.GetAdPushCreativeConverter().ConvertToNetworkObject(creative);

            UpdateAdPushCreativeByIdProcessor processor   = new UpdateAdPushCreativeByIdProcessor();
            FakedBusinessTransaction          transaction = new FakedBusinessTransaction();

            transaction.Request = new UpdateAdPushCreativeByIdRequestMessage {
                UserId = 9083, AccountId = 6340, Data = _adPushCreativeData
            };
            processor.Process(transaction);

            UpdateAdPushCreativeByIdResponseMessage rspMsg = (UpdateAdPushCreativeByIdResponseMessage)transaction.Response;
        }
        public void UpdateCampaign()
        {
            GeoTargeting currentGeo = new GeoTargeting("512,513");
            DateTime     startTime  = new DateTime(2013, 5, 24, 12, 00, 0, 0);
            DateTime     endTime    = new DateTime(2013, 5, 29, 12, 00, 0, 0);

            campaign                  = Campaign.Create(5661, 13985, 1, currentGeo, BidTypes.CPC, true, startTime, AdSourceTypes.MobiSage);
            campaign.EndDate          = endTime;
            campaign.Name             = "111";
            campaign.Status           = AdStatus.Delete;
            campaign.IsMoreDaysBudget = 1;
            campaign.MoreDayBudget.Initialize(null);
            campaign.MoreDayBudget.Initialize("('2012-05-25 00:00:00','66.0000'),('2012-05-26 00:00:00','66.0000'),('2012-05-27 00:00:00','66.0000'),('2012-05-28 00:00:00','66.0000'),('2012-05-29 00:00:00','66.0000')");
            campaign.DailyBudget = 5;
            campaign.AdUrl       = "http://iphone.myzaker.com/zaker/ad/adsage.php?u={udid}&t={timestamp}";
            campaign.AppleStore  = "";

            campaignData = ConverterFactory.GetCampaignConverter().ConvertToNetworkObject(campaign);

            UpdateCampaignByIdProcessor processor   = new UpdateCampaignByIdProcessor();
            FakedBusinessTransaction    transaction = new FakedBusinessTransaction();

            transaction.Request = new UpdateCampaignByIdRequestMessage {
                UserId = 4696, Data = campaignData
            };
            processor.Process(transaction);

            UpdateCampaignByIdResponseMessage rsqMsg = (UpdateCampaignByIdResponseMessage)transaction.Response;
        }
        public void CreateNewTextCreative()
        {
            TextAdCreative creative = TextAdCreative.Create(14788UL, 16165UL, 0UL, 100UL, new AdAction(3U));

            creative.Name             = "12";
            creative.Action.Id        = 2;
            creative.Status           = AdStatus.Launching;
            creative.Size.ImageSizeId = 30;
            creative.LogoImageUrl     = "http://172.16.18.6/conversion/15135/c7751dd234cd4414b8e9dc704c4e2cc7.png";
            creative.Title            = "12";
            creative.Desc1            = "12";
            creative.Desc2            = "12";
            creative.DisplayUrl       = "www.baidu.com";
            creative.DestinationUrl   = "www.google.com";
            creative.CustomElement.AddElementItem(1, "123");
            creative.CustomElement.AddElementItem(5, "123");
            creative.CustomElement.AddElementItem(8, "123");

            _adTextCreativeData = ConverterFactory.GetAdTextCreativeConverter().ConvertToNetworkObject(creative);

            CreateNewAdTextCreativeProcessor processor   = new CreateNewAdTextCreativeProcessor();
            FakedBusinessTransaction         transaction = new FakedBusinessTransaction();

            transaction.Request = new CreateNewAdTextCreativeRequestMessage {
                UserId = 9062, AccountId = 5715, Data = _adTextCreativeData
            };
            processor.Process(transaction);

            CreateNewAdTextCreativeResponseMessage rspMsg = (CreateNewAdTextCreativeResponseMessage)transaction.Response;
        }
        public void CreateCampaign()
        {
            GeoTargeting currentGeo = new GeoTargeting("512,513");
            DateTime     startTime  = new DateTime(2013, 12, 30, 14, 00, 0, 0);
            DateTime     endTime    = new DateTime(2014, 1, 1, 00, 00, 0, 0);

            campaign                  = Campaign.Create(5709, 0, 1, currentGeo, BidTypes.CPC, true, startTime, AdSourceTypes.AdHub);
            campaign.EndDate          = endTime;
            campaign.Name             = "7777";
            campaign.Status           = AdStatus.Launching;
            campaign.IsMoreDaysBudget = 0;
            //campaign.MoreDayBudget.Initialize("('2013-06-04','3'),('2013-06-05','3'),('2013-06-06','3')");
            campaign.DailyBudget = 5;
            campaign.AdUrl       = "http://iphone.myzaker.com/zaker/ad/adsage.php?u={udid}&t={timestamp}";
            campaign.AppleStore  = "";

            //campaignData = new CampaignData {AccountId = 5661};

            campaignData = ConverterFactory.GetCampaignConverter().ConvertToNetworkObject(campaign);

            CreateNewCampaignProcessor processor   = new CreateNewCampaignProcessor();
            FakedBusinessTransaction   transaction = new FakedBusinessTransaction();

            transaction.Request = new CreateNewCampaignRequestMessage {
                UserId = 4696, Data = campaignData
            };
            processor.Process(transaction);

            CreateNewCampaignResponseMessage rspMsg = (CreateNewCampaignResponseMessage)transaction.Response;
        }
        public void UpdateTextCreative()
        {
            TextAdCreative creative = TextAdCreative.Create(15073UL, 16244UL, 29834UL, 100UL, new AdAction(0U));

            creative.Name             = "12update";
            creative.Action.Id        = 2;
            creative.Status           = AdStatus.Launching;
            creative.Size.ImageSizeId = 30;
            creative.LogoImageUrl     = "http://172.16.18.6/conversion/15135/c7751dd234cd4414b8e9dc704c4e2cc7.png";
            creative.Title            = "12";
            creative.Desc1            = "12";
            creative.Desc2            = "12";
            creative.DisplayUrl       = "www.baidu.com.cn";
            creative.DestinationUrl   = "www.google.com.cn";

            _adTextCreativeData = ConverterFactory.GetAdTextCreativeConverter().ConvertToNetworkObject(creative);

            UpdateAdTextCreativeByIdProcessor processor   = new UpdateAdTextCreativeByIdProcessor();
            FakedBusinessTransaction          transaction = new FakedBusinessTransaction();

            transaction.Request = new UpdateAdTextCreativeByIdRequestMessage {
                UserId = 9083, AccountId = 6179, Data = _adTextCreativeData
            };
            processor.Process(transaction);

            UpdateAdTextCreativeByIdResponseMessage rspMsg = (UpdateAdTextCreativeByIdResponseMessage)transaction.Response;
        }
        public void GetCampaginAndAdGroupSimpleData()
        {
            GetCampaignAndAdGroupSimpleByIdProcessor processor = new GetCampaignAndAdGroupSimpleByIdProcessor();
            FakedBusinessTransaction transaction = new FakedBusinessTransaction();

            transaction.Request = new GetCampaignAndAdGroupSimpleByIdRequestMessage {
                CampaignId = 14159, UserId = 1234, GetGoodsType = GetGoodsTypes.Campaign
            };
            processor.Process(transaction);
            GetCampaignAndAdGroupSimpleByIdResponseMessage rsqMsg = (GetCampaignAndAdGroupSimpleByIdResponseMessage)transaction.Response;
        }
        public void GetTextCreativeById()
        {
            GetAdTextCreativeByIdProcessor processor   = new GetAdTextCreativeByIdProcessor();
            FakedBusinessTransaction       transaction = new FakedBusinessTransaction();

            transaction.Request = new GetAdTextCreativeByIdRequestMessage {
                UserId = 9083, AccountId = 6179, AdCreativeId = 29834
            };
            processor.Process(transaction);
            GetAdTextCreativeByIdResponseMessage rsqMsg = (GetAdTextCreativeByIdResponseMessage)transaction.Response;
        }
        public void UpdateGroupStatus()
        {
            ulong[] GroupId = { 16001, 16000, 15926, 15925, 15921, 15840, 15839, 15798, 15730 };
            UpdateStatusByIdProcessor processor   = new UpdateStatusByIdProcessor();
            FakedBusinessTransaction  transaction = new FakedBusinessTransaction();

            transaction.Request = new UpdateStatusByIdsRequestMessage {
                AccountId = 6179, Ids = GroupId, GoodsType = AdGoodsTypes.Group, Status = AdStatus.Pause
            };
            processor.Process(transaction);
            UpdateStatusByIdsResponseMessage rsqMsg = (UpdateStatusByIdsResponseMessage)transaction.Response;
        }
        public void UpdateCampaignStatus()
        {
            ulong[] campaginId = { 15075, 15048, 14589, 14426, 14424, 14422, 14420, 14419 };
            UpdateCampaignStatusProcessor processor   = new UpdateCampaignStatusProcessor();
            FakedBusinessTransaction      transaction = new FakedBusinessTransaction();

            transaction.Request = new UpdateCampaignStatusRequestMessage {
                AccountId = 5730, CampaignId = campaginId, UserId = 4696
            };
            processor.Process(transaction);
            UpdateCampaignStatusResponseMessage rsqMsg = (UpdateCampaignStatusResponseMessage)transaction.Response;
        }
        public void GetCampaignById()
        {
            GetCampaignByIdProcessor processor   = new GetCampaignByIdProcessor();
            FakedBusinessTransaction transaction = new FakedBusinessTransaction();

            transaction.Request = new GetCampaignByIdRequestMessage {
                CampaignId = 15415, AccountId = 5709, UserId = 4696
            };
            processor.Process(transaction);

            GetCampaignByIdResponseMessage rsqMsg = (GetCampaignByIdResponseMessage)transaction.Response;
        }
        public void GetImagesize()
        {
            GetImageSizeProcessor    processor   = new GetImageSizeProcessor();
            FakedBusinessTransaction transaction = new FakedBusinessTransaction();

            transaction.Request = new GetImageSizesRequestMessage()
            {
                AdGroupId = 16393, MediaTypeId = 1, ImageType = ImageTypes.VerticalScreen
            };
            processor.Process(transaction);
            GetImageSizesResponseMessage rsqMsg = (GetImageSizesResponseMessage)transaction.Response;
        }
        public void GetPushCreativeById()
        {
            GetAdPushCreativeByIdProcessor processor   = new GetAdPushCreativeByIdProcessor();
            FakedBusinessTransaction       transaction = new FakedBusinessTransaction();

            transaction.Request = new GetAdPushCreativeByIdRequestMessage {
                AdCreativeId = 29688, AccountId = 6179, UserId = 9083
            };
            processor.Process(transaction);

            GetAdPushCreativeByIdResponseMessage rspMsg = (GetAdPushCreativeByIdResponseMessage)transaction.Response;
        }
        public void GetAdVideoById()
        {
            GetAdVideoCreativeByIdProcessor processor   = new GetAdVideoCreativeByIdProcessor();
            FakedBusinessTransaction        transaction = new FakedBusinessTransaction();

            transaction.Request = new GetAdVideoCreativeByIdRequestMessage {
                AdCreativeId = 28157UL, AccountId = 5661, UserId = 4696
            };
            processor.Process(transaction);

            GetAdVideoCreativeByIdResponseMessage rsqMsg = (GetAdVideoCreativeByIdResponseMessage)transaction.Response;
        }
        public void GetImageSizeTest()
        {
            FakedBusinessTransaction transaction = new FakedBusinessTransaction();

            transaction.Request = new GetImageSizesRequestMessage {
                AdGroupId = 15142, MediaTypeId = 1, ImageType = ImageTypes.Single
            };
            _processor.Process(transaction);
            GetImageSizesResponseMessage rspMsg = (GetImageSizesResponseMessage)transaction.Response;

            Assert.IsNotNull(rspMsg);
            Assert.IsNotNull(rspMsg.Data);
            Assert.IsTrue(rspMsg.ErrorId == 0);
        }
        public void GetImageSizeTest2()
        {
            FakedBusinessTransaction transaction = new FakedBusinessTransaction();

            transaction.Request = new GetImageSizesByMediaTypeIdRequestMessage {
                AdGroupId = 15142, MediaTypeId = 1
            };
            _processor.Process(transaction);
            GetImageSizesByMediaTypeIdResponseMessage rspMsg = (GetImageSizesByMediaTypeIdResponseMessage)transaction.Response;

            Assert.IsNotNull(rspMsg);
            Assert.IsNotNull(rspMsg.Data);
            Assert.IsTrue(rspMsg.ErrorId == 0);

            List <AdSizeCategory>  collection = new List <AdSizeCategory>(rspMsg.Data.Select(value => ConverterFactory.GetAdSizeCategoryConverter().ConvertToDomainObject(value)).ToList());
            IList <AdSizeCategory> result     = collection;

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Count > 0);
        }
        public void GetImageSizeTest2()
        {
            FakedBusinessTransaction transaction = new FakedBusinessTransaction();

            transaction.Request = new GetImageSizesRequestMessage {
                AdGroupId = 15142, MediaTypeId = 1, ImageType = ImageTypes.Single
            };
            _processor.Process(transaction);
            GetImageSizesResponseMessage rspMsg = (GetImageSizesResponseMessage)transaction.Response;

            Assert.IsNotNull(rspMsg);
            Assert.IsNotNull(rspMsg.Data);
            Assert.IsTrue(rspMsg.ErrorId == 0);

            ImageSizeCollection collection = new ImageSizeCollection(rspMsg.Data.Select(value => ConverterFactory.GetAppTypeLevelConverter().ConvertToDomainObject(value)).ToArray());
            IList <AdSize>      result     = collection.GetSizeGroupByMaxSize(48, 320);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Count > 0);
        }
        public void UpdateBatchNewTextCreatives()
        {
            UpdateBatchAdNewTextCreativesByIdsProcessor _processor = new UpdateBatchAdNewTextCreativesByIdsProcessor();

            ulong[] cids = { 30220, 30216 };
            BatchNewTextCreativeData batchCreative = new BatchNewTextCreativeData {
                DestinationUrl = "http://mws.adsage.com/mobisage/Test/1/52/201112011109091689.png", TrackUrl = "http://www.tracing-update-url3333333333333333.com", CustomElement = "2^:^新文字2^#^3^:^1的份上^#^4^:^5"
            };
            FakedBusinessTransaction transaction = new FakedBusinessTransaction();

            transaction.Request = new UpdateBatchNewTextCreativesByIdsRequestMessage {
                AccountId = 6341, CreativeIds = cids, Data = batchCreative
            };
            _processor.Process(transaction);
            UpdateBatchNewTextCreativesByIdsResponseMessage rspMsg = (UpdateBatchNewTextCreativesByIdsResponseMessage)transaction.Response;

            Assert.IsNotNull(rspMsg);
            Assert.IsNotNull(rspMsg.ErrorId);
            Assert.IsTrue(rspMsg.ErrorId == 0);
        }
        public void UpdateBatchCreatives()
        {
            UpdateBatchAdCreativesByIdsProcessor _processor = new UpdateBatchAdCreativesByIdsProcessor();

            ulong[]           cids          = { 30220, 30216, 30140 };
            BatchCreativeData batchCreative = new BatchCreativeData
            {
                DestinationUrl = "http://mws.adsage.com/mobisage/Test/1/52/20.png",
                TrackUrl       = "http://www.tracing-update-url.com"
            };
            FakedBusinessTransaction transaction = new FakedBusinessTransaction();

            transaction.Request = new UpdateBatchAdCreativesByIdsRequestMessage {
                UserId = 9310, AccountId = 6341, BatchEditType = BatchEditType.Mix, CreativeIds = cids, Data = batchCreative
            };
            _processor.Process(transaction);
            UpdateBatchAdCreativesByIdsResponseMessage rspMsg = (UpdateBatchAdCreativesByIdsResponseMessage)transaction.Response;

            Assert.IsNotNull(rspMsg);
            Assert.IsNotNull(rspMsg.ErrorId);
            Assert.IsTrue(rspMsg.ErrorId == 0);
        }
        public void UpdateVideoCreative()
        {
            VideoAdCreative creative = VideoAdCreative.Create(13337UL, 15135UL, 28157UL, 100UL, new AdAction(0U));

            creative.Name                 = "update12";
            creative.Action.Id            = 2;
            creative.Status               = AdStatus.Launching;
            creative.VideoPreviewImageUrl = "http://172.16.18.6/conversion/15135/c7751dd234cd4414b8e9dc704c4e2cc7.png";
            creative.VideoUrl             = "http://172.16.18.6/conversion/15135/201306030429304055.mp4";
            creative.DestinationUrl       = creative.VideoUrl;
            creative.Size.ImageSizeId     = 109;

            _adVideoCreativeData = ConverterFactory.GetAdVideoCreativeConverter().ConvertToNetworkObject(creative);

            UpdateAdVideoCreativeByIdProcessor processor   = new UpdateAdVideoCreativeByIdProcessor();
            FakedBusinessTransaction           transaction = new FakedBusinessTransaction();

            transaction.Request = new UpdateAdVideoCreativeByIdRequestMessage {
                UserId = 8973, AccountId = 5658, Data = _adVideoCreativeData
            };
            processor.Process(transaction);

            UpdateAdVideoCreativeByIdResponseMessage rspMsg = (UpdateAdVideoCreativeByIdResponseMessage)transaction.Response;
        }