Provides tests for the and SalesPerson objects (entity, collection and repository).
Esempio n. 1
0
        ///<summary>
        ///  Returns a Typed SalesTerritoryHistory Entity with mock values.
        ///</summary>
        static public SalesTerritoryHistory CreateMockInstance_Generated(TransactionManager tm)
        {
            SalesTerritoryHistory mock = new SalesTerritoryHistory();

            mock.StartDate    = TestUtility.Instance.RandomDateTime();
            mock.EndDate      = TestUtility.Instance.RandomDateTime();
            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            SalesPerson mockSalesPersonBySalesPersonId = SalesPersonTest.CreateMockInstance(tm);

            DataRepository.SalesPersonProvider.Insert(tm, mockSalesPersonBySalesPersonId);
            mock.SalesPersonId = mockSalesPersonBySalesPersonId.SalesPersonId;
            //OneToOneRelationship
            SalesTerritory mockSalesTerritoryByTerritoryId = SalesTerritoryTest.CreateMockInstance(tm);

            DataRepository.SalesTerritoryProvider.Insert(tm, mockSalesTerritoryByTerritoryId);
            mock.TerritoryId = mockSalesTerritoryByTerritoryId.TerritoryId;

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

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


            return((SalesTerritoryHistory)mock);
        }
Esempio n. 2
0
        ///<summary>
        ///  Update the Typed SalesPerson Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, SalesPerson mock)
        {
            SalesPersonTest.UpdateMockInstance_Generated(tm, mock);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);
        }
        ///<summary>
        ///  Update the Typed SalesPersonQuotaHistory Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance_Generated(TransactionManager tm, SalesPersonQuotaHistory mock)
        {
            mock.SalesQuota   = TestUtility.Instance.RandomShort();
            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            SalesPerson mockSalesPersonBySalesPersonId = SalesPersonTest.CreateMockInstance(tm);

            DataRepository.SalesPersonProvider.Insert(tm, mockSalesPersonBySalesPersonId);
            mock.SalesPersonId = mockSalesPersonBySalesPersonId.SalesPersonId;
        }
Esempio n. 4
0
        ///<summary>
        ///  Returns a Typed SalesPerson Entity with mock values.
        ///</summary>
        static public SalesPerson CreateMockInstance(TransactionManager tm)
        {
            // get the default mock instance
            SalesPerson mock = SalesPersonTest.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);
        }