Nettiers.AdventureWorks.UnitTests.ProductVendorTest.Step_30_TestFindByQuery_Generated C# (CSharp) Method

Step_30_TestFindByQuery_Generated() private method

Test Find using the Query class
private Step_30_TestFindByQuery_Generated ( ) : void
return void
		private void Step_30_TestFindByQuery_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				//Insert Mock Instance
				ProductVendor mock = CreateMockInstance(tm);
				bool result = DataRepository.ProductVendorProvider.Insert(tm, mock);
				
				Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed");

				ProductVendorQuery query = new ProductVendorQuery();
			
				query.AppendEquals(ProductVendorColumn.ProductId, mock.ProductId.ToString());
				query.AppendEquals(ProductVendorColumn.VendorId, mock.VendorId.ToString());
				query.AppendEquals(ProductVendorColumn.AverageLeadTime, mock.AverageLeadTime.ToString());
				query.AppendEquals(ProductVendorColumn.StandardPrice, mock.StandardPrice.ToString());
				if(mock.LastReceiptCost != null)
					query.AppendEquals(ProductVendorColumn.LastReceiptCost, mock.LastReceiptCost.ToString());
				if(mock.LastReceiptDate != null)
					query.AppendEquals(ProductVendorColumn.LastReceiptDate, mock.LastReceiptDate.ToString());
				query.AppendEquals(ProductVendorColumn.MinOrderQty, mock.MinOrderQty.ToString());
				query.AppendEquals(ProductVendorColumn.MaxOrderQty, mock.MaxOrderQty.ToString());
				if(mock.OnOrderQty != null)
					query.AppendEquals(ProductVendorColumn.OnOrderQty, mock.OnOrderQty.ToString());
				query.AppendEquals(ProductVendorColumn.UnitMeasureCode, mock.UnitMeasureCode.ToString());
				query.AppendEquals(ProductVendorColumn.ModifiedDate, mock.ModifiedDate.ToString());
				
				TList<ProductVendor> results = DataRepository.ProductVendorProvider.Find(tm, query);
				
				Assert.IsTrue(results.Count == 1, "Find is not working correctly.  Failed to find the mock instance");
			}
		}