Exemplo n.º 1
0
        internal static void AssertEqual(this ISetShippingInstructions expected, ShipmentInformation result, ShippingLabel soldTo = null)
        {
            expected = expected ?? new SetShippingInstructions();

            Assert.AreEqual(expected.RequiredDeliveryDateTime, result.RequiredDeliveryDate);
            Assert.AreEqual(expected.ShipmentDate, result.ShipmentDate);
            Assert.AreEqual(expected.InternalNotes, result.InternalNotes);
            Assert.AreEqual(expected.ExternalNotes, result.ExternalNotes);
            Assert.AreEqual(expected.SpecialInstructions, result.SpecialInstructions);
            expected.ShipFromOrSoldTo.AssertEquivalent(soldTo ?? result.ShipFrom);
            expected.ShipTo.AssertEquivalent(result.ShipTo);
            expected.FreightBillTo.AssertEquivalent(result.FreightBill);
        }
Exemplo n.º 2
0
        internal static void AssertEqual(this ShipmentInformation expected, ISetShippingInstructions shippingInstructions, ShippingLabel soldTo = null)
        {
            if (expected == null)
            {
                throw new ArgumentNullException("expected");
            }

            if (shippingInstructions == null)
            {
                Assert.IsNull(expected.RequiredDeliveryDate);
                Assert.IsNull(expected.ShipmentDate);
                Assert.IsNull(expected.InternalNotes);
                Assert.IsNull(expected.ExternalNotes);
                Assert.IsNull(expected.SpecialInstructions);

                expected.ShipFrom.AssertEqual(null);
                expected.ShipTo.AssertEqual(null);
                expected.FreightBill.AssertEqual(null);
            }
            else
            {
                Assert.AreEqual(shippingInstructions.RequiredDeliveryDateTime, expected.RequiredDeliveryDate);
                Assert.AreEqual(shippingInstructions.ShipmentDate, expected.ShipmentDate);
                Assert.AreEqual(shippingInstructions.InternalNotes, expected.InternalNotes);
                Assert.AreEqual(shippingInstructions.ExternalNotes, expected.ExternalNotes);
                Assert.AreEqual(shippingInstructions.SpecialInstructions, expected.SpecialInstructions);

                if (soldTo != null)
                {
                    soldTo.AssertEqual(shippingInstructions.ShipFromOrSoldTo);
                }
                else
                {
                    expected.ShipFrom.AssertEqual(shippingInstructions.ShipFromOrSoldTo);
                }
                expected.ShipTo.AssertEqual(shippingInstructions.ShipTo);
                expected.FreightBill.AssertEqual(shippingInstructions.FreightBillTo);
            }
        }
        private static void SetShippingInstructions(this ShipmentInformation shipInfo, ISetShippingInstructions shippingInstructions, bool setShipFrom)
        {
            if (shipInfo == null)
            {
                throw new ArgumentNullException("shipInfo");
            }

            if (shippingInstructions == null)
            {
                shipInfo.RequiredDeliveryDate = null;
                shipInfo.ShipmentDate         = null;

                shipInfo.InternalNotes       = null;
                shipInfo.ExternalNotes       = null;
                shipInfo.SpecialInstructions = null;

                shipInfo.ShipFrom    = new ShippingLabel();
                shipInfo.ShipTo      = new ShippingLabel();
                shipInfo.FreightBill = new ShippingLabel();
            }
            else
            {
                shipInfo.RequiredDeliveryDate = shippingInstructions.RequiredDeliveryDateTime;
                shipInfo.ShipmentDate         = shippingInstructions.ShipmentDate;

                shipInfo.InternalNotes       = shippingInstructions.InternalNotes;
                shipInfo.ExternalNotes       = shippingInstructions.ExternalNotes;
                shipInfo.SpecialInstructions = shippingInstructions.SpecialInstructions;

                shipInfo.ShipFrom    = (setShipFrom ? shippingInstructions.ShipFromOrSoldTo : null) ?? new ShippingLabel();
                shipInfo.ShipTo      = shippingInstructions.ShipTo ?? new ShippingLabel();
                shipInfo.FreightBill = shippingInstructions.FreightBillTo ?? new ShippingLabel();
            }
        }