コード例 #1
0
        ///<summary>
        ///  Returns a Typed CustomerAndSuppliersByCity Entity with mock values.
        ///</summary>
        public static CustomerAndSuppliersByCity CreateMockInstance()
        {
            CustomerAndSuppliersByCity mock = new CustomerAndSuppliersByCity();

            mock.City = TestUtility.Instance.RandomString(6, false);;
            mock.CompanyName = TestUtility.Instance.RandomString(19, false);;
            mock.ContactName = TestUtility.Instance.RandomString(14, false);;
            mock.Relationship = TestUtility.Instance.RandomString(9, false);;
               return (CustomerAndSuppliersByCity)mock;
        }
コード例 #2
0
        /// <summary>
        /// Deserialize the mock CustomerAndSuppliersByCity entity from a temporary file.
        /// </summary>
        private void Step_7_DeserializeEntity_Generated()
        {
            string fileName = "temp_CustomerAndSuppliersByCity.xml";

            XmlSerializer mySerializer = new XmlSerializer(typeof(CustomerAndSuppliersByCity));
            System.IO.FileStream myFileStream = new System.IO.FileStream(fileName,  System.IO.FileMode.Open);
            mock = (CustomerAndSuppliersByCity) mySerializer.Deserialize(myFileStream);
            myFileStream.Close();
            System.IO.File.Delete(fileName);

            System.Console.WriteLine("mock correctly deserialized from a temporary file.");
        }
コード例 #3
0
 /// <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(CustomerAndSuppliersByCity entity, string propertyName)
 {
     switch (propertyName)
     {
         case "City":
             return entity.City;
         case "CompanyName":
             return entity.CompanyName;
         case "ContactName":
             return entity.ContactName;
         case "Relationship":
             return entity.Relationship;
     }
     return null;
 }
コード例 #4
0
 ///<summary>
 ///  Returns a Typed CustomerAndSuppliersByCityBase Entity 
 ///</summary>
 public virtual CustomerAndSuppliersByCityBase Copy()
 {
     //shallow copy entity
     CustomerAndSuppliersByCity copy = new CustomerAndSuppliersByCity();
         copy.City = this.City;
         copy.CompanyName = this.CompanyName;
         copy.ContactName = this.ContactName;
         copy.Relationship = this.Relationship;
     copy.AcceptChanges();
     return (CustomerAndSuppliersByCity)copy;
 }
コード例 #5
0
 ///<summary>
 /// A simple factory method to create a new <see cref="CustomerAndSuppliersByCity"/> instance.
 ///</summary>
 ///<param name="_city"></param>
 ///<param name="_companyName"></param>
 ///<param name="_contactName"></param>
 ///<param name="_relationship"></param>
 public static CustomerAndSuppliersByCity CreateCustomerAndSuppliersByCity(System.String _city, System.String _companyName, System.String _contactName, System.String _relationship)
 {
     CustomerAndSuppliersByCity newCustomerAndSuppliersByCity = new CustomerAndSuppliersByCity();
     newCustomerAndSuppliersByCity.City = _city;
     newCustomerAndSuppliersByCity.CompanyName = _companyName;
     newCustomerAndSuppliersByCity.ContactName = _contactName;
     newCustomerAndSuppliersByCity.Relationship = _relationship;
     return newCustomerAndSuppliersByCity;
 }