///<summary> /// Returns a Typed OrderDetailsExtended Entity with mock values. ///</summary> public static OrderDetailsExtended CreateMockInstance() { OrderDetailsExtended mock = new OrderDetailsExtended(); mock.OrderId = TestUtility.Instance.RandomNumber(); mock.ProductId = TestUtility.Instance.RandomNumber(); mock.ProductName = TestUtility.Instance.RandomString(19, false);; mock.UnitPrice = TestUtility.Instance.RandomShort(); mock.Quantity = TestUtility.Instance.RandomShort(); mock.Discount = (float)TestUtility.Instance.RandomNumber(); mock.ExtendedPrice = TestUtility.Instance.RandomShort(); return (OrderDetailsExtended)mock; }
///<summary> /// Returns a Typed OrderDetailsExtendedBase Entity ///</summary> public virtual OrderDetailsExtendedBase Copy() { //shallow copy entity OrderDetailsExtended copy = new OrderDetailsExtended(); copy.OrderId = this.OrderId; copy.ProductId = this.ProductId; copy.ProductName = this.ProductName; copy.UnitPrice = this.UnitPrice; copy.Quantity = this.Quantity; copy.Discount = this.Discount; copy.ExtendedPrice = this.ExtendedPrice; copy.AcceptChanges(); return (OrderDetailsExtended)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(OrderDetailsExtended entity, string propertyName) { switch (propertyName) { case "OrderId": return entity.OrderId; case "ProductId": return entity.ProductId; case "ProductName": return entity.ProductName; case "UnitPrice": return entity.UnitPrice; case "Quantity": return entity.Quantity; case "Discount": return entity.Discount; case "ExtendedPrice": return entity.ExtendedPrice; } return null; }
///<summary> /// A simple factory method to create a new <see cref="OrderDetailsExtended"/> instance. ///</summary> ///<param name="_orderId"></param> ///<param name="_productId"></param> ///<param name="_productName"></param> ///<param name="_unitPrice"></param> ///<param name="_quantity"></param> ///<param name="_discount"></param> ///<param name="_extendedPrice"></param> public static OrderDetailsExtended CreateOrderDetailsExtended(System.Int32 _orderId, System.Int32 _productId, System.String _productName, System.Decimal _unitPrice, System.Int16 _quantity, System.Single _discount, System.Decimal? _extendedPrice) { OrderDetailsExtended newOrderDetailsExtended = new OrderDetailsExtended(); newOrderDetailsExtended.OrderId = _orderId; newOrderDetailsExtended.ProductId = _productId; newOrderDetailsExtended.ProductName = _productName; newOrderDetailsExtended.UnitPrice = _unitPrice; newOrderDetailsExtended.Quantity = _quantity; newOrderDetailsExtended.Discount = _discount; newOrderDetailsExtended.ExtendedPrice = _extendedPrice; return newOrderDetailsExtended; }
/// <summary> /// Deserialize the mock OrderDetailsExtended entity from a temporary file. /// </summary> private void Step_7_DeserializeEntity_Generated() { string fileName = "temp_OrderDetailsExtended.xml"; XmlSerializer mySerializer = new XmlSerializer(typeof(OrderDetailsExtended)); System.IO.FileStream myFileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open); mock = (OrderDetailsExtended) mySerializer.Deserialize(myFileStream); myFileStream.Close(); System.IO.File.Delete(fileName); System.Console.WriteLine("mock correctly deserialized from a temporary file."); }