///<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; }
///<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; }
/// <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; }
///<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; }
/// <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."); }