Пример #1
0
        /// <summary>
        /// Convert a nettiers collection to the ws proxy collection.
        /// </summary>
        public static VVendor Convert(WsProxy.VVendor item)
        {
            VVendor outItem = new VVendor();

            outItem.VendorId          = item.VendorId;
            outItem.Name              = item.Name;
            outItem.ContactType       = item.ContactType;
            outItem.Title             = item.Title;
            outItem.FirstName         = item.FirstName;
            outItem.MiddleName        = item.MiddleName;
            outItem.LastName          = item.LastName;
            outItem.Suffix            = item.Suffix;
            outItem.Phone             = item.Phone;
            outItem.EmailAddress      = item.EmailAddress;
            outItem.EmailPromotion    = item.EmailPromotion;
            outItem.AddressLine1      = item.AddressLine1;
            outItem.AddressLine2      = item.AddressLine2;
            outItem.City              = item.City;
            outItem.StateProvinceName = item.StateProvinceName;
            outItem.PostalCode        = item.PostalCode;
            outItem.CountryRegionName = item.CountryRegionName;

            outItem.AcceptChanges();
            return(outItem);
        }
        /// <summary>
        /// Deserialize the mock VVendor entity from a temporary file.
        /// </summary>
        private void Step_7_DeserializeEntity_Generated()
        {
            string fileName = "temp_VVendor.xml";

            XmlSerializer mySerializer = new XmlSerializer(typeof(VVendor));

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

            System.Console.WriteLine("mock correctly deserialized from a temporary file.");
        }
        ///<summary>
        ///  Returns a Typed VVendor Entity with mock values.
        ///</summary>
        static public VVendor CreateMockInstance()
        {
            VVendor mock = new VVendor();

            mock.VendorId          = TestUtility.Instance.RandomNumber();
            mock.Name              = TestUtility.Instance.RandomString(24, false);;
            mock.ContactType       = TestUtility.Instance.RandomString(24, false);;
            mock.Title             = TestUtility.Instance.RandomString(8, false);;
            mock.FirstName         = TestUtility.Instance.RandomString(24, false);;
            mock.MiddleName        = TestUtility.Instance.RandomString(24, false);;
            mock.LastName          = TestUtility.Instance.RandomString(24, false);;
            mock.Suffix            = TestUtility.Instance.RandomString(10, false);;
            mock.Phone             = TestUtility.Instance.RandomString(11, false);;
            mock.EmailAddress      = TestUtility.Instance.RandomString(24, false);;
            mock.EmailPromotion    = TestUtility.Instance.RandomNumber();
            mock.AddressLine1      = TestUtility.Instance.RandomString(29, false);;
            mock.AddressLine2      = TestUtility.Instance.RandomString(29, false);;
            mock.City              = TestUtility.Instance.RandomString(14, false);;
            mock.StateProvinceName = TestUtility.Instance.RandomString(24, false);;
            mock.PostalCode        = TestUtility.Instance.RandomString(6, false);;
            mock.CountryRegionName = TestUtility.Instance.RandomString(24, false);;
            return((VVendor)mock);
        }