コード例 #1
0
 public void Init() {
   TestUtils utils = new TestUtils();
   creativeService = (CreativeService)user.GetService(DfpService.v201306.CreativeService);
   advertiserId = utils.CreateCompany(user, CompanyType.ADVERTISER).id;
   creative1 = utils.CreateCreative(user, advertiserId);
   creative2 = utils.CreateCreative(user, advertiserId);
 }
コード例 #2
0
 public void Init() {
   TestUtils utils = new TestUtils();
   userService = (UserService) user.GetService(DfpService.v201306.UserService);
   salespersonId = utils.GetSalesperson(user).id;
   traffickerId = utils.GetTrafficker(user).id;
   currentUserId = utils.GetCurrentUser(user).id;
 }
コード例 #3
0
 public void Init() {
   TestUtils utils = new TestUtils();
   placementService = (PlacementService) user.GetService(DfpService.v201306.PlacementService);
   adUnit1 = utils.CreateAdUnit(user);
   adUnit2 = utils.CreateAdUnit(user);
   placement = utils.CreatePlacement(user, new string[] {adUnit1.id, adUnit2.id});
 }
コード例 #4
0
    public void Init() {
      TestUtils utils = new TestUtils();
      orderService = (OrderService) user.GetService(DfpService.v201306.OrderService);

      advertiserId = utils.CreateCompany(user, CompanyType.ADVERTISER).id;
      salespersonId = utils.GetSalesperson(user).id;
      traffickerId = utils.GetTrafficker(user).id;

      orderId = utils.CreateOrder(user, advertiserId, salespersonId, traffickerId).id;
    }
コード例 #5
0
    public void Init() {
      TestUtils utils = new TestUtils();
      forecastService = (ForecastService)user.GetService(DfpService.v201306.ForecastService);
      advertiserId = utils.CreateCompany(user, CompanyType.ADVERTISER).id;
      salespersonId = utils.GetSalesperson(user).id;
      traffickerId = utils.GetTrafficker(user).id;

      orderId = utils.CreateOrder(user, advertiserId, salespersonId, traffickerId).id;
      adUnitId = utils.CreateAdUnit(user).id;
      placementId = utils.CreatePlacement(user, new string[] {adUnitId}).id;
      lineItemId = utils.CreateLineItem(user, orderId, adUnitId).id;
    }
コード例 #6
0
 public void Init() {
   TestUtils utils = new TestUtils();
   reportService = (ReportService) user.GetService(DfpService.v201306.ReportService);
   reportId = utils.CreateReport(user).id;
 }
コード例 #7
0
    public void TestCreatePlacements() {
      TestUtils utils = new TestUtils();
      Placement placement1 = new Placement();
      placement1.name = string.Format("Medium Square AdUnit Placement #{0}", utils.GetTimeStamp());
      placement1.description = "Contains ad units that can hold creatives of size 300x250";
      placement1.targetedAdUnitIds = new string[] {adUnit1.id, adUnit2.id};

      Placement placement2 = new Placement();
      placement2.name = string.Format("Medium Square AdUnit Placement #{0}", utils.GetTimeStamp());
      placement2.description = "Contains ad units that can hold creatives of size 300x250";
      placement2.targetedAdUnitIds = new string[] {adUnit1.id, adUnit2.id};

      Placement[] newPlacements = null;

      Assert.DoesNotThrow(delegate() {
        newPlacements = placementService.createPlacements(new Placement[] {placement1, placement2});
      });

      Assert.NotNull(newPlacements);
      Assert.AreEqual(newPlacements.Length, 2);

      Assert.NotNull(newPlacements[0]);
      Assert.AreEqual(newPlacements[0].name, placement1.name);
      Assert.AreEqual(newPlacements[0].description, placement1.description);
      Assert.Contains(adUnit1.id, newPlacements[0].targetedAdUnitIds);
      Assert.Contains(adUnit2.id, newPlacements[0].targetedAdUnitIds);

      Assert.NotNull(newPlacements[1]);
      Assert.AreEqual(newPlacements[1].name, placement2.name);
      Assert.AreEqual(newPlacements[1].description, placement2.description);
      Assert.Contains(adUnit1.id, newPlacements[1].targetedAdUnitIds);
      Assert.Contains(adUnit2.id, newPlacements[1].targetedAdUnitIds);
    }
    public void Init() {
      TestUtils utils = new TestUtils();
      licaService = (LineItemCreativeAssociationService) user.GetService(
          DfpService.v201306.LineItemCreativeAssociationService);
      advertiserId = utils.CreateCompany(user, CompanyType.ADVERTISER).id;
      salespersonId = utils.GetSalesperson(user).id;
      traffickerId = utils.GetTrafficker(user).id;

      orderId = utils.CreateOrder(user, advertiserId, salespersonId, traffickerId).id;
      adUnitId = utils.CreateAdUnit(user).id;

      lineItemId1 = utils.CreateLineItem(user, orderId, adUnitId).id;
      lineItemId2 = utils.CreateLineItem(user, orderId, adUnitId).id;
      lineItemId3 = utils.CreateLineItem(user, orderId, adUnitId).id;
      lineItemId4 = utils.CreateLineItem(user, orderId, adUnitId).id;

      creativeId1 = utils.CreateCreative(user, advertiserId).id;
      creativeId2 = utils.CreateCreative(user, advertiserId).id;
      creativeId3 = utils.CreateCreative(user, advertiserId).id;
      creativeId4 = utils.CreateCreative(user, advertiserId).id;

      lica1 = utils.CreateLica(user, lineItemId3, creativeId3);
      lica2 = utils.CreateLica(user, lineItemId4, creativeId4);
    }
コード例 #9
0
    public void TestGetForecast() {
      TestUtils utils = new TestUtils();

      LineItem lineItem = new LineItem();
      lineItem.name = string.Format("Line item #{0}", utils.GetTimeStamp());

      lineItem.orderId = orderId;

      lineItem.targeting = new Targeting();
      lineItem.targeting.inventoryTargeting = new InventoryTargeting();
      lineItem.targeting.inventoryTargeting.targetedPlacementIds = new long[] {placementId};

      Size size1 = new Size();
      size1.width = 300;
      size1.height = 250;

      Size size2 = new Size();
      size2.width = 120;
      size2.height = 600;

      // Create the creative placeholders.
      CreativePlaceholder creativePlaceholder1 = new CreativePlaceholder();
      creativePlaceholder1.size = size1;

      CreativePlaceholder creativePlaceholder2 = new CreativePlaceholder();
      creativePlaceholder1.size = size2;

      lineItem.creativePlaceholders =
          new CreativePlaceholder[] {creativePlaceholder1, creativePlaceholder2};

      lineItem.lineItemType = LineItemType.STANDARD;

      // Set start date time and end date time.
      lineItem.startDateTime = DateTimeUtilities.FromDateTime(System.DateTime.Today.AddDays(1));
      lineItem.endDateTime = DateTimeUtilities.FromDateTime(System.DateTime.Today.AddMonths(1));

      lineItem.costType = CostType.CPM;
      lineItem.costPerUnit = new Money();
      lineItem.costPerUnit.currencyCode = "USD";
      lineItem.costPerUnit.microAmount = 2000000;

      lineItem.creativeRotationType = CreativeRotationType.EVEN;
      lineItem.discountType = LineItemDiscountType.PERCENTAGE;

      lineItem.unitsBought = 500000;
      lineItem.unitType = UnitType.IMPRESSIONS;

      Forecast forecast = null;
      Assert.DoesNotThrow(delegate() {
        forecast = forecastService.getForecast(lineItem);
      });
      Assert.NotNull(forecast);
      Assert.AreEqual(forecast.orderId, orderId);
      Assert.AreEqual(forecast.unitType, lineItem.unitType);
    }
コード例 #10
0
 public void Init() {
   TestUtils utils = new TestUtils();
   companyService = (CompanyService) user.GetService(DfpService.v201306.CompanyService);
   testCompany1 = utils.CreateCompany(user, CompanyType.ADVERTISER);
   testCompany2 = utils.CreateCompany(user, CompanyType.ADVERTISER);
 }
コード例 #11
0
 public void Init() {
   TestUtils utils = new TestUtils();
   inventoryService = (InventoryService) user.GetService(DfpService.v201306.InventoryService);
   adUnit1 = utils.CreateAdUnit(user);
   adUnit2 = utils.CreateAdUnit(user);
 }