///<summary> /// Returns a Typed ProductsAboveAveragePrice Entity with mock values. ///</summary> public static ProductsAboveAveragePrice CreateMockInstance() { ProductsAboveAveragePrice mock = new ProductsAboveAveragePrice(); mock.ProductName = TestUtility.Instance.RandomString(19, false);; mock.UnitPrice = TestUtility.Instance.RandomShort(); return (ProductsAboveAveragePrice)mock; }
/// <summary> /// Deserialize the mock ProductsAboveAveragePrice entity from a temporary file. /// </summary> private void Step_7_DeserializeEntity_Generated() { string fileName = "temp_ProductsAboveAveragePrice.xml"; XmlSerializer mySerializer = new XmlSerializer(typeof(ProductsAboveAveragePrice)); System.IO.FileStream myFileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open); mock = (ProductsAboveAveragePrice) mySerializer.Deserialize(myFileStream); myFileStream.Close(); System.IO.File.Delete(fileName); System.Console.WriteLine("mock correctly deserialized from a temporary file."); }
/// <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(ProductsAboveAveragePrice entity, string propertyName) { switch (propertyName) { case "ProductName": return entity.ProductName; case "UnitPrice": return entity.UnitPrice; } return null; }
///<summary> /// Returns a Typed ProductsAboveAveragePriceBase Entity ///</summary> public virtual ProductsAboveAveragePriceBase Copy() { //shallow copy entity ProductsAboveAveragePrice copy = new ProductsAboveAveragePrice(); copy.ProductName = this.ProductName; copy.UnitPrice = this.UnitPrice; copy.AcceptChanges(); return (ProductsAboveAveragePrice)copy; }
///<summary> /// A simple factory method to create a new <see cref="ProductsAboveAveragePrice"/> instance. ///</summary> ///<param name="_productName"></param> ///<param name="_unitPrice"></param> public static ProductsAboveAveragePrice CreateProductsAboveAveragePrice(System.String _productName, System.Decimal? _unitPrice) { ProductsAboveAveragePrice newProductsAboveAveragePrice = new ProductsAboveAveragePrice(); newProductsAboveAveragePrice.ProductName = _productName; newProductsAboveAveragePrice.UnitPrice = _unitPrice; return newProductsAboveAveragePrice; }