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