コード例 #1
0
        ///<summary>
        ///  Returns a Typed OrderSubtotals Entity with mock values.
        ///</summary>
        public static OrderSubtotals CreateMockInstance()
        {
            OrderSubtotals mock = new OrderSubtotals();

            mock.OrderId = TestUtility.Instance.RandomNumber();
            mock.Subtotal = TestUtility.Instance.RandomShort();
               return (OrderSubtotals)mock;
        }
コード例 #2
0
 ///<summary>
 ///  Returns a Typed OrderSubtotalsBase Entity 
 ///</summary>
 public virtual OrderSubtotalsBase Copy()
 {
     //shallow copy entity
     OrderSubtotals copy = new OrderSubtotals();
         copy.OrderId = this.OrderId;
         copy.Subtotal = this.Subtotal;
     copy.AcceptChanges();
     return (OrderSubtotals)copy;
 }
コード例 #3
0
 /// <summary>
 /// Gets the property value by name.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="propertyName">Name of the property.</param>
 /// <returns></returns>
 public static object GetPropertyValueByName(OrderSubtotals entity, string propertyName)
 {
     switch (propertyName)
     {
         case "OrderId":
             return entity.OrderId;
         case "Subtotal":
             return entity.Subtotal;
     }
     return null;
 }
コード例 #4
0
 ///<summary>
 /// A simple factory method to create a new <see cref="OrderSubtotals"/> instance.
 ///</summary>
 ///<param name="_orderId"></param>
 ///<param name="_subtotal"></param>
 public static OrderSubtotals CreateOrderSubtotals(System.Int32 _orderId, System.Decimal? _subtotal)
 {
     OrderSubtotals newOrderSubtotals = new OrderSubtotals();
     newOrderSubtotals.OrderId = _orderId;
     newOrderSubtotals.Subtotal = _subtotal;
     return newOrderSubtotals;
 }
コード例 #5
0
        /// <summary>
        /// Deserialize the mock OrderSubtotals entity from a temporary file.
        /// </summary>
        private void Step_7_DeserializeEntity_Generated()
        {
            string fileName = "temp_OrderSubtotals.xml";

            XmlSerializer mySerializer = new XmlSerializer(typeof(OrderSubtotals));
            System.IO.FileStream myFileStream = new System.IO.FileStream(fileName,  System.IO.FileMode.Open);
            mock = (OrderSubtotals) mySerializer.Deserialize(myFileStream);
            myFileStream.Close();
            System.IO.File.Delete(fileName);

            System.Console.WriteLine("mock correctly deserialized from a temporary file.");
        }