///<summary> /// Returns a Typed SalesTotalsByAmount Entity with mock values. ///</summary> public static SalesTotalsByAmount CreateMockInstance() { SalesTotalsByAmount mock = new SalesTotalsByAmount(); mock.SaleAmount = TestUtility.Instance.RandomShort(); mock.OrderId = TestUtility.Instance.RandomNumber(); mock.CompanyName = TestUtility.Instance.RandomString(19, false);; mock.ShippedDate = TestUtility.Instance.RandomDateTime(); return (SalesTotalsByAmount)mock; }
///<summary> /// Returns a Typed SalesTotalsByAmountBase Entity ///</summary> public virtual SalesTotalsByAmountBase Copy() { //shallow copy entity SalesTotalsByAmount copy = new SalesTotalsByAmount(); copy.SaleAmount = this.SaleAmount; copy.OrderId = this.OrderId; copy.CompanyName = this.CompanyName; copy.ShippedDate = this.ShippedDate; copy.AcceptChanges(); return (SalesTotalsByAmount)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(SalesTotalsByAmount entity, string propertyName) { switch (propertyName) { case "SaleAmount": return entity.SaleAmount; case "OrderId": return entity.OrderId; case "CompanyName": return entity.CompanyName; case "ShippedDate": return entity.ShippedDate; } return null; }
///<summary> /// A simple factory method to create a new <see cref="SalesTotalsByAmount"/> instance. ///</summary> ///<param name="_saleAmount"></param> ///<param name="_orderId"></param> ///<param name="_companyName"></param> ///<param name="_shippedDate"></param> public static SalesTotalsByAmount CreateSalesTotalsByAmount(System.Decimal? _saleAmount, System.Int32 _orderId, System.String _companyName, System.DateTime? _shippedDate) { SalesTotalsByAmount newSalesTotalsByAmount = new SalesTotalsByAmount(); newSalesTotalsByAmount.SaleAmount = _saleAmount; newSalesTotalsByAmount.OrderId = _orderId; newSalesTotalsByAmount.CompanyName = _companyName; newSalesTotalsByAmount.ShippedDate = _shippedDate; return newSalesTotalsByAmount; }
/// <summary> /// Deserialize the mock SalesTotalsByAmount entity from a temporary file. /// </summary> private void Step_7_DeserializeEntity_Generated() { string fileName = "temp_SalesTotalsByAmount.xml"; XmlSerializer mySerializer = new XmlSerializer(typeof(SalesTotalsByAmount)); System.IO.FileStream myFileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open); mock = (SalesTotalsByAmount) mySerializer.Deserialize(myFileStream); myFileStream.Close(); System.IO.File.Delete(fileName); System.Console.WriteLine("mock correctly deserialized from a temporary file."); }