///<summary> /// Returns a Typed Invoices Entity with mock values. ///</summary> public static Invoices CreateMockInstance() { Invoices mock = new Invoices(); mock.ShipName = TestUtility.Instance.RandomString(19, false);; mock.ShipAddress = TestUtility.Instance.RandomString(29, false);; mock.ShipCity = TestUtility.Instance.RandomString(6, false);; mock.ShipRegion = TestUtility.Instance.RandomString(6, false);; mock.ShipPostalCode = TestUtility.Instance.RandomString(10, false);; mock.ShipCountry = TestUtility.Instance.RandomString(6, false);; mock.CustomerId = TestUtility.Instance.RandomString(5, false);; mock.CustomerName = TestUtility.Instance.RandomString(19, false);; mock.Address = TestUtility.Instance.RandomString(29, false);; mock.City = TestUtility.Instance.RandomString(6, false);; mock.Region = TestUtility.Instance.RandomString(6, false);; mock.PostalCode = TestUtility.Instance.RandomString(10, false);; mock.Country = TestUtility.Instance.RandomString(6, false);; mock.Salesperson = TestUtility.Instance.RandomString(14, false);; mock.OrderId = TestUtility.Instance.RandomNumber(); mock.OrderDate = TestUtility.Instance.RandomDateTime(); mock.RequiredDate = TestUtility.Instance.RandomDateTime(); mock.ShippedDate = TestUtility.Instance.RandomDateTime(); mock.ShipperName = TestUtility.Instance.RandomString(19, false);; 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(); mock.Freight = TestUtility.Instance.RandomShort(); return (Invoices)mock; }
/// <summary> /// Deserialize the mock Invoices entity from a temporary file. /// </summary> private void Step_7_DeserializeEntity_Generated() { string fileName = "temp_Invoices.xml"; XmlSerializer mySerializer = new XmlSerializer(typeof(Invoices)); System.IO.FileStream myFileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open); mock = (Invoices) 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(Invoices entity, string propertyName) { switch (propertyName) { case "ShipName": return entity.ShipName; case "ShipAddress": return entity.ShipAddress; case "ShipCity": return entity.ShipCity; case "ShipRegion": return entity.ShipRegion; case "ShipPostalCode": return entity.ShipPostalCode; case "ShipCountry": return entity.ShipCountry; case "CustomerId": return entity.CustomerId; case "CustomerName": return entity.CustomerName; case "Address": return entity.Address; case "City": return entity.City; case "Region": return entity.Region; case "PostalCode": return entity.PostalCode; case "Country": return entity.Country; case "Salesperson": return entity.Salesperson; case "OrderId": return entity.OrderId; case "OrderDate": return entity.OrderDate; case "RequiredDate": return entity.RequiredDate; case "ShippedDate": return entity.ShippedDate; case "ShipperName": return entity.ShipperName; 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; case "Freight": return entity.Freight; } return null; }
///<summary> /// Returns a Typed InvoicesBase Entity ///</summary> public virtual InvoicesBase Copy() { //shallow copy entity Invoices copy = new Invoices(); copy.ShipName = this.ShipName; copy.ShipAddress = this.ShipAddress; copy.ShipCity = this.ShipCity; copy.ShipRegion = this.ShipRegion; copy.ShipPostalCode = this.ShipPostalCode; copy.ShipCountry = this.ShipCountry; copy.CustomerId = this.CustomerId; copy.CustomerName = this.CustomerName; copy.Address = this.Address; copy.City = this.City; copy.Region = this.Region; copy.PostalCode = this.PostalCode; copy.Country = this.Country; copy.Salesperson = this.Salesperson; copy.OrderId = this.OrderId; copy.OrderDate = this.OrderDate; copy.RequiredDate = this.RequiredDate; copy.ShippedDate = this.ShippedDate; copy.ShipperName = this.ShipperName; 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.Freight = this.Freight; copy.AcceptChanges(); return (Invoices)copy; }
///<summary> /// A simple factory method to create a new <see cref="Invoices"/> instance. ///</summary> ///<param name="_shipName"></param> ///<param name="_shipAddress"></param> ///<param name="_shipCity"></param> ///<param name="_shipRegion"></param> ///<param name="_shipPostalCode"></param> ///<param name="_shipCountry"></param> ///<param name="_customerId"></param> ///<param name="_customerName"></param> ///<param name="_address"></param> ///<param name="_city"></param> ///<param name="_region"></param> ///<param name="_postalCode"></param> ///<param name="_country"></param> ///<param name="_salesperson"></param> ///<param name="_orderId"></param> ///<param name="_orderDate"></param> ///<param name="_requiredDate"></param> ///<param name="_shippedDate"></param> ///<param name="_shipperName"></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> ///<param name="_freight"></param> public static Invoices CreateInvoices(System.String _shipName, System.String _shipAddress, System.String _shipCity, System.String _shipRegion, System.String _shipPostalCode, System.String _shipCountry, System.String _customerId, System.String _customerName, System.String _address, System.String _city, System.String _region, System.String _postalCode, System.String _country, System.String _salesperson, System.Int32 _orderId, System.DateTime? _orderDate, System.DateTime? _requiredDate, System.DateTime? _shippedDate, System.String _shipperName, System.Int32 _productId, System.String _productName, System.Decimal _unitPrice, System.Int16 _quantity, System.Single _discount, System.Decimal? _extendedPrice, System.Decimal? _freight) { Invoices newInvoices = new Invoices(); newInvoices.ShipName = _shipName; newInvoices.ShipAddress = _shipAddress; newInvoices.ShipCity = _shipCity; newInvoices.ShipRegion = _shipRegion; newInvoices.ShipPostalCode = _shipPostalCode; newInvoices.ShipCountry = _shipCountry; newInvoices.CustomerId = _customerId; newInvoices.CustomerName = _customerName; newInvoices.Address = _address; newInvoices.City = _city; newInvoices.Region = _region; newInvoices.PostalCode = _postalCode; newInvoices.Country = _country; newInvoices.Salesperson = _salesperson; newInvoices.OrderId = _orderId; newInvoices.OrderDate = _orderDate; newInvoices.RequiredDate = _requiredDate; newInvoices.ShippedDate = _shippedDate; newInvoices.ShipperName = _shipperName; newInvoices.ProductId = _productId; newInvoices.ProductName = _productName; newInvoices.UnitPrice = _unitPrice; newInvoices.Quantity = _quantity; newInvoices.Discount = _discount; newInvoices.ExtendedPrice = _extendedPrice; newInvoices.Freight = _freight; return newInvoices; }