static public CreateMockInstance ( TransactionManager tm ) : |
||
tm | TransactionManager | |
return |
///<summary> /// Returns a Typed Individual Entity with mock values. ///</summary> static public Individual CreateMockInstance_Generated(TransactionManager tm) { Individual mock = new Individual(); mock.Demographics = "<test></test>"; mock.ModifiedDate = TestUtility.Instance.RandomDateTime(); //OneToOneRelationship Contact mockContactByContactId = ContactTest.CreateMockInstance(tm); DataRepository.ContactProvider.Insert(tm, mockContactByContactId); mock.ContactId = mockContactByContactId.ContactId; //OneToOneRelationship Customer mockCustomerByCustomerId = CustomerTest.CreateMockInstance(tm); DataRepository.CustomerProvider.Insert(tm, mockCustomerByCustomerId); mock.CustomerId = mockCustomerByCustomerId.CustomerId; // create a temporary collection and add the item to it TList <Individual> tempMockCollection = new TList <Individual>(); tempMockCollection.Add(mock); tempMockCollection.Remove(mock); return((Individual)mock); }
///<summary> /// Returns a Typed Store Entity with mock values. ///</summary> static public Store CreateMockInstance_Generated(TransactionManager tm) { Store mock = new Store(); mock.Name = TestUtility.Instance.RandomString(24, false);; mock.Demographics = "<test></test>"; mock.ModifiedDate = TestUtility.Instance.RandomDateTime(); //OneToOneRelationship Customer mockCustomerByCustomerId = CustomerTest.CreateMockInstance(tm); DataRepository.CustomerProvider.Insert(tm, mockCustomerByCustomerId); mock.CustomerId = mockCustomerByCustomerId.CustomerId; int count1 = 0; TList <SalesPerson> _collection1 = DataRepository.SalesPersonProvider.GetPaged(tm, 0, 10, out count1); //_collection1.Shuffle(); if (_collection1.Count > 0) { mock.SalesPersonId = _collection1[0].SalesPersonId; } // create a temporary collection and add the item to it TList <Store> tempMockCollection = new TList <Store>(); tempMockCollection.Add(mock); tempMockCollection.Remove(mock); return((Store)mock); }
///<summary> /// Returns a Typed CustomerAddress Entity with mock values. ///</summary> static public CustomerAddress CreateMockInstance_Generated(TransactionManager tm) { CustomerAddress mock = new CustomerAddress(); mock.ModifiedDate = TestUtility.Instance.RandomDateTime(); //OneToOneRelationship Address mockAddressByAddressId = AddressTest.CreateMockInstance(tm); DataRepository.AddressProvider.Insert(tm, mockAddressByAddressId); mock.AddressId = mockAddressByAddressId.AddressId; //OneToOneRelationship AddressType mockAddressTypeByAddressTypeId = AddressTypeTest.CreateMockInstance(tm); DataRepository.AddressTypeProvider.Insert(tm, mockAddressTypeByAddressTypeId); mock.AddressTypeId = mockAddressTypeByAddressTypeId.AddressTypeId; //OneToOneRelationship Customer mockCustomerByCustomerId = CustomerTest.CreateMockInstance(tm); DataRepository.CustomerProvider.Insert(tm, mockCustomerByCustomerId); mock.CustomerId = mockCustomerByCustomerId.CustomerId; // create a temporary collection and add the item to it TList <CustomerAddress> tempMockCollection = new TList <CustomerAddress>(); tempMockCollection.Add(mock); tempMockCollection.Remove(mock); return((CustomerAddress)mock); }
///<summary> /// Update the Typed Individual Entity with modified mock values. ///</summary> static public void UpdateMockInstance_Generated(TransactionManager tm, Individual mock) { mock.Demographics = "<test></test>"; mock.ModifiedDate = TestUtility.Instance.RandomDateTime(); //OneToOneRelationship Contact mockContactByContactId = ContactTest.CreateMockInstance(tm); DataRepository.ContactProvider.Insert(tm, mockContactByContactId); mock.ContactId = mockContactByContactId.ContactId; //OneToOneRelationship Customer mockCustomerByCustomerId = CustomerTest.CreateMockInstance(tm); DataRepository.CustomerProvider.Insert(tm, mockCustomerByCustomerId); mock.CustomerId = mockCustomerByCustomerId.CustomerId; }
///<summary> /// Update the Typed Store Entity with modified mock values. ///</summary> static public void UpdateMockInstance_Generated(TransactionManager tm, Store mock) { mock.Name = TestUtility.Instance.RandomString(24, false);; mock.Demographics = "<test></test>"; mock.ModifiedDate = TestUtility.Instance.RandomDateTime(); //OneToOneRelationship Customer mockCustomerByCustomerId = CustomerTest.CreateMockInstance(tm); DataRepository.CustomerProvider.Insert(tm, mockCustomerByCustomerId); mock.CustomerId = mockCustomerByCustomerId.CustomerId; int count1 = 0; TList <SalesPerson> _collection1 = DataRepository.SalesPersonProvider.GetPaged(tm, 0, 10, out count1); //_collection1.Shuffle(); if (_collection1.Count > 0) { mock.SalesPersonId = _collection1[0].SalesPersonId; } }
///<summary> /// Update the Typed CustomerAddress Entity with modified mock values. ///</summary> static public void UpdateMockInstance_Generated(TransactionManager tm, CustomerAddress mock) { mock.ModifiedDate = TestUtility.Instance.RandomDateTime(); //OneToOneRelationship Address mockAddressByAddressId = AddressTest.CreateMockInstance(tm); DataRepository.AddressProvider.Insert(tm, mockAddressByAddressId); mock.AddressId = mockAddressByAddressId.AddressId; //OneToOneRelationship AddressType mockAddressTypeByAddressTypeId = AddressTypeTest.CreateMockInstance(tm); DataRepository.AddressTypeProvider.Insert(tm, mockAddressTypeByAddressTypeId); mock.AddressTypeId = mockAddressTypeByAddressTypeId.AddressTypeId; //OneToOneRelationship Customer mockCustomerByCustomerId = CustomerTest.CreateMockInstance(tm); DataRepository.CustomerProvider.Insert(tm, mockCustomerByCustomerId); mock.CustomerId = mockCustomerByCustomerId.CustomerId; }