CreateMockInstance() static public method

Returns a Typed AddressType Entity with mock values.
static public CreateMockInstance ( TransactionManager tm ) : AddressType
tm TransactionManager
return Nettiers.AdventureWorks.Entities.AddressType
示例#1
0
        ///<summary>
        ///  Returns a Typed VendorAddress Entity with mock values.
        ///</summary>
        static public VendorAddress CreateMockInstance_Generated(TransactionManager tm)
        {
            VendorAddress mock = new VendorAddress();

            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
            Vendor mockVendorByVendorId = VendorTest.CreateMockInstance(tm);

            DataRepository.VendorProvider.Insert(tm, mockVendorByVendorId);
            mock.VendorId = mockVendorByVendorId.VendorId;

            // create a temporary collection and add the item to it
            TList <VendorAddress> tempMockCollection = new TList <VendorAddress>();

            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);


            return((VendorAddress)mock);
        }
示例#2
0
        ///<summary>
        ///  Update the Typed VendorAddress Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance_Generated(TransactionManager tm, VendorAddress 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
            Vendor mockVendorByVendorId = VendorTest.CreateMockInstance(tm);

            DataRepository.VendorProvider.Insert(tm, mockVendorByVendorId);
            mock.VendorId = mockVendorByVendorId.VendorId;
        }