Provides tests for the and Vendor objects (entity, collection and repository).
Пример #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);
        }
        ///<summary>
        ///  Update the Typed ProductVendor Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance_Generated(TransactionManager tm, ProductVendor mock)
        {
            mock.AverageLeadTime = TestUtility.Instance.RandomNumber();
            mock.StandardPrice   = TestUtility.Instance.RandomShort();
            mock.LastReceiptCost = TestUtility.Instance.RandomShort();
            mock.LastReceiptDate = TestUtility.Instance.RandomDateTime();
            mock.MinOrderQty     = TestUtility.Instance.RandomNumber();
            mock.MaxOrderQty     = TestUtility.Instance.RandomNumber();
            mock.OnOrderQty      = TestUtility.Instance.RandomNumber();
            mock.ModifiedDate    = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Product mockProductByProductId = ProductTest.CreateMockInstance(tm);

            DataRepository.ProductProvider.Insert(tm, mockProductByProductId);
            mock.ProductId = mockProductByProductId.ProductId;

            //OneToOneRelationship
            UnitMeasure mockUnitMeasureByUnitMeasureCode = UnitMeasureTest.CreateMockInstance(tm);

            DataRepository.UnitMeasureProvider.Insert(tm, mockUnitMeasureByUnitMeasureCode);
            mock.UnitMeasureCode = mockUnitMeasureByUnitMeasureCode.UnitMeasureCode;

            //OneToOneRelationship
            Vendor mockVendorByVendorId = VendorTest.CreateMockInstance(tm);

            DataRepository.VendorProvider.Insert(tm, mockVendorByVendorId);
            mock.VendorId = mockVendorByVendorId.VendorId;
        }
Пример #3
0
        ///<summary>
        ///  Update the Typed Vendor Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, Vendor mock)
        {
            VendorTest.UpdateMockInstance_Generated(tm, mock);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);
        }
Пример #4
0
        ///<summary>
        ///  Returns a Typed Vendor Entity with mock values.
        ///</summary>
        static public Vendor CreateMockInstance(TransactionManager tm)
        {
            // get the default mock instance
            Vendor mock = VendorTest.CreateMockInstance_Generated(tm);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);

            // return the modified object
            return(mock);
        }
Пример #5
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;
        }
Пример #6
0
        ///<summary>
        ///  Update the Typed VendorContact Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance_Generated(TransactionManager tm, VendorContact mock)
        {
            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Contact mockContactByContactId = ContactTest.CreateMockInstance(tm);

            DataRepository.ContactProvider.Insert(tm, mockContactByContactId);
            mock.ContactId = mockContactByContactId.ContactId;

            //OneToOneRelationship
            ContactType mockContactTypeByContactTypeId = ContactTypeTest.CreateMockInstance(tm);

            DataRepository.ContactTypeProvider.Insert(tm, mockContactTypeByContactTypeId);
            mock.ContactTypeId = mockContactTypeByContactTypeId.ContactTypeId;

            //OneToOneRelationship
            Vendor mockVendorByVendorId = VendorTest.CreateMockInstance(tm);

            DataRepository.VendorProvider.Insert(tm, mockVendorByVendorId);
            mock.VendorId = mockVendorByVendorId.VendorId;
        }
        ///<summary>
        ///  Returns a Typed ProductVendor Entity with mock values.
        ///</summary>
        static public ProductVendor CreateMockInstance_Generated(TransactionManager tm)
        {
            ProductVendor mock = new ProductVendor();

            mock.AverageLeadTime = TestUtility.Instance.RandomNumber();
            mock.StandardPrice   = TestUtility.Instance.RandomShort();
            mock.LastReceiptCost = TestUtility.Instance.RandomShort();
            mock.LastReceiptDate = TestUtility.Instance.RandomDateTime();
            mock.MinOrderQty     = TestUtility.Instance.RandomNumber();
            mock.MaxOrderQty     = TestUtility.Instance.RandomNumber();
            mock.OnOrderQty      = TestUtility.Instance.RandomNumber();
            mock.ModifiedDate    = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Product mockProductByProductId = ProductTest.CreateMockInstance(tm);

            DataRepository.ProductProvider.Insert(tm, mockProductByProductId);
            mock.ProductId = mockProductByProductId.ProductId;
            //OneToOneRelationship
            UnitMeasure mockUnitMeasureByUnitMeasureCode = UnitMeasureTest.CreateMockInstance(tm);

            DataRepository.UnitMeasureProvider.Insert(tm, mockUnitMeasureByUnitMeasureCode);
            mock.UnitMeasureCode = mockUnitMeasureByUnitMeasureCode.UnitMeasureCode;
            //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 <ProductVendor> tempMockCollection = new TList <ProductVendor>();

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


            return((ProductVendor)mock);
        }