public void OneItemShipsInTwoBoxes()
        {
            ShipItemBox box;
              string xml;

              //Console.WriteLine("Using AddMerchantItemId");
              ShipItemsRequest req = new ShipItemsRequest(
            "1234", "5678", EnvironmentType.Sandbox.ToString(), originalOrderID);
              req.SendEmail = true;
              req.AddMerchantItemId("UPS", "55555555", "A1");
              req.AddMerchantItemId("UPS", "77777777", "A1");

              Assert.AreEqual(req.ItemShippingInfo.Length, 1);
              xml = Util.EncodeHelper.Utf8BytesToString(req.GetXml());

              //Console.WriteLine("Using Boxes");

              //now we want to try the same thing with adding boxes and
              //putting items into the boxes.
              req = new ShipItemsRequest(
            "1234", "5678", EnvironmentType.Sandbox.ToString(), originalOrderID);
              req.SendEmail = true;
              box = req.AddBox("UPS", "55555555");
              box.AddMerchantItemID("A1");
              box = req.AddBox("UPS", "77777777");
              box.AddMerchantItemID("A1");

              Assert.AreEqual(req.ItemShippingInfo.Length, 1);

              xml = Util.EncodeHelper.Utf8BytesToString(req.GetXml());
        }
        public void TwoItemsShippedInTwoBoxes()
        {
            ShipItemBox box;
              string xml;

              //Console.WriteLine("Using AddMerchantItemId");
              ShipItemsRequest req = new ShipItemsRequest(
              "1234", "5678", EnvironmentType.Sandbox.ToString(), originalOrderID);
              req.SendEmail = true;
              req.AddMerchantItemId("UPS", "55555555", "A1");
              req.AddMerchantItemId("UPS", "77777777", "B2");

              Assert.AreEqual(req.ItemShippingInfo.Length, 2);

              xml = Util.EncodeHelper.Utf8BytesToString(req.GetXml());
              VerifyTwoItemsShippingInTwoBoxes(xml, false);

              req = new ShipItemsRequest(originalOrderID);
              req.SendEmail = true;
              req.AddMerchantItemId("UPS", "55555555", "A1");
              req.AddMerchantItemId("UPS", "77777777", "B2");

              Assert.AreEqual(req.ItemShippingInfo.Length, 2);

              xml = Util.EncodeHelper.Utf8BytesToString(req.GetXml());
              VerifyTwoItemsShippingInTwoBoxes(xml, false);

              //Console.WriteLine("Using Boxes");

              //now we want to try the same thing with adding boxes and
              //putting items into the boxes.
              req = new ShipItemsRequest(
            "1234", "5678", EnvironmentType.Sandbox.ToString(), originalOrderID);
              req.SendEmail = true;
              box = req.AddBox("UPS", "55555555");
              box.AddMerchantItemID("A1");
              box = req.AddBox("UPS", "77777777");
              box.AddMerchantItemID("B2");

              Assert.AreEqual(box.Carrier, "UPS");
              Assert.AreEqual(box.TrackingNumber, "77777777");

              //you can't add the same box twice
              try {
            box = req.AddBox("UPS", "55555555");
            Assert.Fail("The same box can't be added twice.");
              }
              catch {
              }

              //you can't add an empty merchantitemid
              try {
            box.AddMerchantItemID(string.Empty);
            Assert.Fail("you can't add an empty merchantitemid.");
              }
              catch {
              }

              //you can't add a duplicate merchantitemid
              try {
            box.AddMerchantItemID("B2");
            Assert.Fail("you can't add a duplicate merchantitemid.");
              }
              catch {
              }

              Assert.AreEqual(req.ItemShippingInfo.Length, 2);

              xml = Util.EncodeHelper.Utf8BytesToString(req.GetXml());
              VerifyTwoItemsShippingInTwoBoxes(xml, false);

              //Console.WriteLine("Google Items using AddGoogleItemId");

              req = new ShipItemsRequest(
            "1234", "5678", EnvironmentType.Sandbox.ToString(), originalOrderID);
              req.SendEmail = true;
              req.AddMerchantItemId("UPS", "55555555", "123456");
              req.AddMerchantItemId("UPS", "77777777", "7891234");

              Assert.AreEqual(req.ItemShippingInfo.Length, 2);

              xml = Util.EncodeHelper.Utf8BytesToString(req.GetXml());
              VerifyTwoItemsShippingInTwoBoxes(xml, true);

              //Console.WriteLine("Google Items using Boxes");

              //now we want to try the same thing with adding boxes and
              //putting items into the boxes.
              req = new ShipItemsRequest(
            "1234", "5678", EnvironmentType.Sandbox.ToString(), originalOrderID);
              req.SendEmail = true;
              box = req.AddBox("UPS", "55555555");
              box.AddMerchantItemID("123456");
              box = req.AddBox("UPS", "77777777");
              box.AddMerchantItemID("7891234");

              Assert.AreEqual(req.ItemShippingInfo.Length, 2);

              xml = Util.EncodeHelper.Utf8BytesToString(req.GetXml());
              VerifyTwoItemsShippingInTwoBoxes(xml, true);
        }