Inheritance: TestProductBase
        /// <summary>
        /// Convert a nettiers collection to the ws proxy collection.
        /// </summary>
        public static Nettiers.AdventureWorks.Entities.TestProduct Convert(Nettiers.AdventureWorks.Entities.TestProduct outItem, WsProxy.TestProduct item)
        {
            if (item != null && outItem != null)
            {
                outItem.ProductId         = item.ProductId;
                outItem.ProductTypeId     = item.ProductTypeId;
                outItem.DownloadId        = item.DownloadId;
                outItem.ManufacturerId    = item.ManufacturerId;
                outItem.BrandName         = item.BrandName;
                outItem.ProductName       = item.ProductName;
                outItem.ProductCode       = item.ProductCode;
                outItem.UniqueIdentifier  = item.UniqueIdentifier;
                outItem.TypeName          = item.TypeName;
                outItem.ModelName         = item.ModelName;
                outItem.DisplayName       = item.DisplayName;
                outItem.ProductLink       = item.ProductLink;
                outItem.ConnectorCode     = item.ConnectorCode;
                outItem.BaseId            = item.BaseId;
                outItem.OrgProductId      = item.OrgProductId;
                outItem.ImageFileType     = item.ImageFileType;
                outItem.FullImageFileType = item.FullImageFileType;
                outItem.Status            = item.Status;
                outItem.AddedBy           = item.AddedBy;
                outItem.AddedDate         = item.AddedDate;
                outItem.UpdatedBy         = item.UpdatedBy;
                outItem.UpdatedDate       = item.UpdatedDate;

                outItem.AcceptChanges();
            }

            return(outItem);
        }
Ejemplo n.º 2
0
		/// <summary>
		/// Inserts a mock TestProduct entity into the database.
		/// </summary>
		private void Step_01_Insert_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				mock = CreateMockInstance(tm);
				Assert.IsTrue(DataRepository.TestProductProvider.Insert(tm, mock), "Insert failed");
										
				System.Console.WriteLine("DataRepository.TestProductProvider.Insert(mock):");			
				System.Console.WriteLine(mock);			
				
				//normally one would commit here
				//tm.Commit();
				//IDisposable will Rollback Transaction since it's left uncommitted
			}
		}
        /// <summary>
        ///     Inserts a Nettiers.AdventureWorks.Entities.TestProduct object into the datasource using a transaction.
        /// </summary>
        /// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
        /// <param name="entity">Nettiers.AdventureWorks.Entities.TestProduct object to insert.</param>
        /// <remarks></remarks>
        /// <returns>Returns true if operation is successful.</returns>
        public override bool Insert(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.TestProduct entity)
        {
            WsProxy.AdventureWorksServices proxy = new WsProxy.AdventureWorksServices();
            proxy.Url = Url;

            try
            {
                WsProxy.TestProduct result = proxy.TestProductProvider_Insert(Convert(entity));
                Convert(entity, result);
                return(true);
            }
            catch (SoapException soex)
            {
                System.Diagnostics.Debug.WriteLine(soex);
                throw soex;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
                throw ex;
            }
        }
Ejemplo n.º 4
0
		///<summary>
		///  Update the Typed TestProduct Entity with modified mock values.
		///</summary>
		static public void UpdateMockInstance_Generated(TransactionManager tm, TestProduct mock)
		{
			mock.ProductTypeId = TestUtility.Instance.RandomNumber();
			mock.DownloadId = TestUtility.Instance.RandomNumber();
			mock.ManufacturerId = TestUtility.Instance.RandomNumber();
			mock.BrandName = TestUtility.Instance.RandomString(249, false);;
			mock.ProductName = TestUtility.Instance.RandomString(249, false);;
			mock.ProductCode = TestUtility.Instance.RandomString(49, false);;
			mock.UniqueIdentifier = TestUtility.Instance.RandomString(249, false);;
			mock.TypeName = TestUtility.Instance.RandomString(24, false);;
			mock.ModelName = TestUtility.Instance.RandomString(74, false);;
			mock.DisplayName = TestUtility.Instance.RandomString(74, false);;
			mock.ProductLink = TestUtility.Instance.RandomString(499, false);;
			mock.ConnectorCode = TestUtility.Instance.RandomString(499, false);;
			mock.BaseId = TestUtility.Instance.RandomNumber();
			mock.OrgProductId = TestUtility.Instance.RandomNumber();
			mock.ImageFileType = TestUtility.Instance.RandomString(1, false);;
			mock.FullImageFileType = TestUtility.Instance.RandomString(1, false);;
			mock.Status = TestUtility.Instance.RandomString(1, false);;
			mock.AddedBy = TestUtility.Instance.RandomNumber();
			mock.AddedDate = TestUtility.Instance.RandomDateTime();
			mock.UpdatedBy = TestUtility.Instance.RandomNumber();
			mock.UpdatedDate = TestUtility.Instance.RandomDateTime();
			
		}
Ejemplo n.º 5
0
		///<summary>
		///  Returns a Typed TestProduct Entity with mock values.
		///</summary>
		static public TestProduct CreateMockInstance_Generated(TransactionManager tm)
		{		
			TestProduct mock = new TestProduct();
						
			mock.ProductTypeId = TestUtility.Instance.RandomNumber();
			mock.DownloadId = TestUtility.Instance.RandomNumber();
			mock.ManufacturerId = TestUtility.Instance.RandomNumber();
			mock.BrandName = TestUtility.Instance.RandomString(249, false);;
			mock.ProductName = TestUtility.Instance.RandomString(249, false);;
			mock.ProductCode = TestUtility.Instance.RandomString(49, false);;
			mock.UniqueIdentifier = TestUtility.Instance.RandomString(249, false);;
			mock.TypeName = TestUtility.Instance.RandomString(24, false);;
			mock.ModelName = TestUtility.Instance.RandomString(74, false);;
			mock.DisplayName = TestUtility.Instance.RandomString(74, false);;
			mock.ProductLink = TestUtility.Instance.RandomString(499, false);;
			mock.ConnectorCode = TestUtility.Instance.RandomString(499, false);;
			mock.BaseId = TestUtility.Instance.RandomNumber();
			mock.OrgProductId = TestUtility.Instance.RandomNumber();
			mock.ImageFileType = TestUtility.Instance.RandomString(1, false);;
			mock.FullImageFileType = TestUtility.Instance.RandomString(1, false);;
			mock.Status = TestUtility.Instance.RandomString(1, false);;
			mock.AddedBy = TestUtility.Instance.RandomNumber();
			mock.AddedDate = TestUtility.Instance.RandomDateTime();
			mock.UpdatedBy = TestUtility.Instance.RandomNumber();
			mock.UpdatedDate = TestUtility.Instance.RandomDateTime();
			
		
			// create a temporary collection and add the item to it
			TList<TestProduct> tempMockCollection = new TList<TestProduct>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (TestProduct)mock;
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Test methods exposed by the EntityHelper class.
		/// </summary>
		private void Step_20_TestEntityHelper_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				mock = CreateMockInstance(tm);
				
				TestProduct entity = mock.Copy() as TestProduct;
				entity = (TestProduct)mock.Clone();
				Assert.IsTrue(TestProduct.ValueEquals(entity, mock), "Clone is not working");
			}
		}
Ejemplo n.º 7
0
		/// <summary>
		/// Serialize a TestProduct collection into a temporary file.
		/// </summary>
		private void Step_08_SerializeCollection_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_TestProductCollection.xml");
				
				mock = CreateMockInstance(tm);
				TList<TestProduct> mockCollection = new TList<TestProduct>();
				mockCollection.Add(mock);
			
				EntityHelper.SerializeXml(mockCollection, fileName);
				
				Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found");
				System.Console.WriteLine("TList<TestProduct> correctly serialized to a temporary file.");					
			}
		}
Ejemplo n.º 8
0
		/// <summary>
		/// Serialize the mock TestProduct entity into a temporary file.
		/// </summary>
		private void Step_06_SerializeEntity_Generated()
		{	
			using (TransactionManager tm = CreateTransaction())
			{
				mock =  CreateMockInstance(tm);
				string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_TestProduct.xml");
			
				EntityHelper.SerializeXml(mock, fileName);
				Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock not found");
					
				System.Console.WriteLine("mock correctly serialized to a temporary file.");			
			}
		}
Ejemplo n.º 9
0
		/// <summary>
		/// Deep load all TestProduct children.
		/// </summary>
		private void Step_03_DeepLoad_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				int count = -1;
				mock =  CreateMockInstance(tm);
				mockCollection = DataRepository.TestProductProvider.GetPaged(tm, 0, 10, out count);
			
				DataRepository.TestProductProvider.DeepLoading += new EntityProviderBaseCore<TestProduct, TestProductKey>.DeepLoadingEventHandler(
						delegate(object sender, DeepSessionEventArgs e)
						{
							if (e.DeepSession.Count > 3)
								e.Cancel = true;
						}
					);

				if (mockCollection.Count > 0)
				{
					
					DataRepository.TestProductProvider.DeepLoad(tm, mockCollection[0]);
					System.Console.WriteLine("TestProduct instance correctly deep loaded at 1 level.");
									
					mockCollection.Add(mock);
					// DataRepository.TestProductProvider.DeepSave(tm, mockCollection);
				}
				
				//normally one would commit here
				//tm.Commit();
				//IDisposable will Rollback Transaction since it's left uncommitted
			}
		}
 /// <summary>
 /// Convert a nettiers collection to the ws proxy collection.
 /// </summary>
 public static Nettiers.AdventureWorks.Entities.TestProduct Convert(WsProxy.TestProduct item)
 {
     Nettiers.AdventureWorks.Entities.TestProduct outItem = item == null ? null : new Nettiers.AdventureWorks.Entities.TestProduct();
     Convert(outItem, item);
     return(outItem);
 }
Ejemplo n.º 11
0
		/// <summary>
        /// Make any alterations necessary (i.e. for DB check constraints, special test cases, etc.)
        /// </summary>
        /// <param name="mock">Object to be modified</param>
        static private void SetSpecialTestData(TestProduct mock)
        {
            //Code your changes to the data object here.
        }
Ejemplo n.º 12
0
        ///<summary>
        ///  Update the Typed TestProduct Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, TestProduct mock)
        {
            TestProductTest.UpdateMockInstance_Generated(tm, mock);
            
			// make any alterations necessary 
            // (i.e. for DB check constraints, special test cases, etc.)
			SetSpecialTestData(mock);
        }