/// <summary>
 /// Adds a <see cref="IShipment"/> to the extended data collection
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <param name="shipment">
 /// The shipment.
 /// </param>
 public static void AddShipment(this ExtendedDataCollection extendedData, IShipment shipment)
 {
     extendedData.AddAddress(shipment.GetOriginAddress(), Constants.ExtendedDataKeys.ShippingOriginAddress);
     extendedData.AddAddress(shipment.GetDestinationAddress(), Constants.ExtendedDataKeys.ShippingDestinationAddress);
     extendedData.SetValue(Constants.ExtendedDataKeys.ShipMethodKey, shipment.ShipMethodKey.ToString());
     extendedData.AddLineItemCollection(shipment.Items);
 }
Ejemplo n.º 2
0
        public void Can_Serialize_A_LineItemCollection_And_Store_In_ExtendedData()
        {
            //// Arrange
            var extendedData = new ExtendedDataCollection();

            //// Act
            extendedData.AddLineItemCollection(_shipment.Items);
            Console.Write(extendedData.GetValue(Constants.ExtendedDataKeys.LineItemCollection));

            //// Assert
            Assert.DoesNotThrow(() => XDocument.Parse(extendedData.GetValue(Constants.ExtendedDataKeys.LineItemCollection)));
        }
Ejemplo n.º 3
0
        public void Can_Deserialize_A_LineItemCollection_From_ExtendedDataCollection()
        {
            //// Arrange
            var extendedData = new ExtendedDataCollection();

            extendedData.AddLineItemCollection(_shipment.Items);
            Console.Write(extendedData.GetValue(Constants.ExtendedDataKeys.LineItemCollection));

            //// Act
            var lineItemCollection = extendedData.GetLineItemCollection <ItemCacheLineItem>();

            //// Assert
            Assert.NotNull(lineItemCollection);
            Assert.IsTrue(lineItemCollection.Any());
        }
Ejemplo n.º 4
0
        public void Can_Deserialize_A_LineItemCollection_Stored_In_A_Serialized_ExtendedDataCollection()
        {
            //// Arrange
            var extendedDataContainer = new ExtendedDataCollection();
            var extendedDataWrapper   = new ExtendedDataCollection();

            extendedDataWrapper.AddLineItemCollection(_shipment.Items);
            extendedDataContainer.AddExtendedDataCollection(extendedDataWrapper);
            Console.Write(extendedDataContainer.SerializeToXml());

            //// Act
            var retrievedExtendedDataWrapper = extendedDataContainer.GetExtendedDataCollection();

            Assert.NotNull(retrievedExtendedDataWrapper);
            var lineItemCollection = retrievedExtendedDataWrapper.GetLineItemCollection <ItemCacheLineItem>();

            //// Assert
            Assert.NotNull(lineItemCollection);
            Assert.IsTrue(lineItemCollection.Any());
        }
Ejemplo n.º 5
0
        public void Can_Deserialize_A_LineItemCollection_From_ExtendedDataCollection()
        {
            //// Arrange
            var extendedData = new ExtendedDataCollection();
            extendedData.AddLineItemCollection(_shipment.Items);
            Console.Write(extendedData.GetValue(Constants.ExtendedDataKeys.LineItemCollection));

            //// Act
            var lineItemCollection = extendedData.GetLineItemCollection<ItemCacheLineItem>();

            //// Assert
            Assert.NotNull(lineItemCollection);
            Assert.IsTrue(lineItemCollection.Any());
        }
Ejemplo n.º 6
0
        public void Can_Serialize_A_LineItemCollection_And_Store_In_ExtendedData()
        {
            //// Arrange
            var extendedData = new ExtendedDataCollection();

            //// Act
            extendedData.AddLineItemCollection(_shipment.Items);
            Console.Write(extendedData.GetValue(Constants.ExtendedDataKeys.LineItemCollection));

            //// Assert
            Assert.DoesNotThrow(() => XDocument.Parse(extendedData.GetValue(Constants.ExtendedDataKeys.LineItemCollection)));
        }
Ejemplo n.º 7
0
        public void Can_Deserialize_A_LineItemCollection_Stored_In_A_Serialized_ExtendedDataCollection()
        {
            //// Arrange
            var extendedDataContainer = new ExtendedDataCollection();
            var extendedDataWrapper = new ExtendedDataCollection();
            extendedDataWrapper.AddLineItemCollection(_shipment.Items);
            extendedDataContainer.AddExtendedDataCollection(extendedDataWrapper);
            Console.Write(extendedDataContainer.SerializeToXml());

            //// Act
            var retrievedExtendedDataWrapper = extendedDataContainer.GetExtendedDataCollection();
            Assert.NotNull(retrievedExtendedDataWrapper);
            var lineItemCollection = retrievedExtendedDataWrapper.GetLineItemCollection<ItemCacheLineItem>();

            //// Assert
            Assert.NotNull(lineItemCollection);
            Assert.IsTrue(lineItemCollection.Any());
        }