CreateMockInstance() static public méthode

Returns a Typed Employee Entity with mock values.
static public CreateMockInstance ( TransactionManager tm ) : Employee
tm TransactionManager
Résultat Nettiers.AdventureWorks.Entities.Employee
Exemple #1
0
        ///<summary>
        ///  Returns a Typed EmployeeDepartmentHistory Entity with mock values.
        ///</summary>
        static public EmployeeDepartmentHistory CreateMockInstance_Generated(TransactionManager tm)
        {
            EmployeeDepartmentHistory mock = new EmployeeDepartmentHistory();

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

            //OneToOneRelationship
            Department mockDepartmentByDepartmentId = DepartmentTest.CreateMockInstance(tm);

            DataRepository.DepartmentProvider.Insert(tm, mockDepartmentByDepartmentId);
            mock.DepartmentId = mockDepartmentByDepartmentId.DepartmentId;
            //OneToOneRelationship
            Employee mockEmployeeByEmployeeId = EmployeeTest.CreateMockInstance(tm);

            DataRepository.EmployeeProvider.Insert(tm, mockEmployeeByEmployeeId);
            mock.EmployeeId = mockEmployeeByEmployeeId.EmployeeId;
            //OneToOneRelationship
            Shift mockShiftByShiftId = ShiftTest.CreateMockInstance(tm);

            DataRepository.ShiftProvider.Insert(tm, mockShiftByShiftId);
            mock.ShiftId = mockShiftByShiftId.ShiftId;

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

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


            return((EmployeeDepartmentHistory)mock);
        }
Exemple #2
0
        ///<summary>
        ///  Returns a Typed SalesPerson Entity with mock values.
        ///</summary>
        static public SalesPerson CreateMockInstance_Generated(TransactionManager tm)
        {
            SalesPerson mock = new SalesPerson();

            mock.SalesQuota    = TestUtility.Instance.RandomShort();
            mock.Bonus         = TestUtility.Instance.RandomShort();
            mock.CommissionPct = TestUtility.Instance.RandomShort();
            mock.SalesYtd      = TestUtility.Instance.RandomShort();
            mock.SalesLastYear = TestUtility.Instance.RandomShort();
            mock.ModifiedDate  = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Employee mockEmployeeBySalesPersonId = EmployeeTest.CreateMockInstance(tm);

            DataRepository.EmployeeProvider.Insert(tm, mockEmployeeBySalesPersonId);
            mock.SalesPersonId = mockEmployeeBySalesPersonId.EmployeeId;
            int count1 = 0;
            TList <SalesTerritory> _collection1 = DataRepository.SalesTerritoryProvider.GetPaged(tm, 0, 10, out count1);

            //_collection1.Shuffle();
            if (_collection1.Count > 0)
            {
                mock.TerritoryId = _collection1[0].TerritoryId;
            }

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

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


            return((SalesPerson)mock);
        }
Exemple #3
0
        ///<summary>
        ///  Returns a Typed EmployeeAddress Entity with mock values.
        ///</summary>
        static public EmployeeAddress CreateMockInstance_Generated(TransactionManager tm)
        {
            EmployeeAddress mock = new EmployeeAddress();

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

            //OneToOneRelationship
            Address mockAddressByAddressId = AddressTest.CreateMockInstance(tm);

            DataRepository.AddressProvider.Insert(tm, mockAddressByAddressId);
            mock.AddressId = mockAddressByAddressId.AddressId;
            //OneToOneRelationship
            Employee mockEmployeeByEmployeeId = EmployeeTest.CreateMockInstance(tm);

            DataRepository.EmployeeProvider.Insert(tm, mockEmployeeByEmployeeId);
            mock.EmployeeId = mockEmployeeByEmployeeId.EmployeeId;

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

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


            return((EmployeeAddress)mock);
        }
        ///<summary>
        ///  Update the Typed JobCandidate Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance_Generated(TransactionManager tm, JobCandidate mock)
        {
            mock.Resume       = "<test></test>";
            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Employee mockEmployeeByEmployeeId = EmployeeTest.CreateMockInstance(tm);

            DataRepository.EmployeeProvider.Insert(tm, mockEmployeeByEmployeeId);
            mock.EmployeeId = mockEmployeeByEmployeeId.EmployeeId;
        }
Exemple #5
0
        ///<summary>
        ///  Update the Typed EmployeePayHistory Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance_Generated(TransactionManager tm, EmployeePayHistory mock)
        {
            mock.Rate         = TestUtility.Instance.RandomShort();
            mock.PayFrequency = TestUtility.Instance.RandomByte();
            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Employee mockEmployeeByEmployeeId = EmployeeTest.CreateMockInstance(tm);

            DataRepository.EmployeeProvider.Insert(tm, mockEmployeeByEmployeeId);
            mock.EmployeeId = mockEmployeeByEmployeeId.EmployeeId;
        }
Exemple #6
0
        ///<summary>
        ///  Update the Typed EmployeeAddress Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance_Generated(TransactionManager tm, EmployeeAddress mock)
        {
            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Address mockAddressByAddressId = AddressTest.CreateMockInstance(tm);

            DataRepository.AddressProvider.Insert(tm, mockAddressByAddressId);
            mock.AddressId = mockAddressByAddressId.AddressId;

            //OneToOneRelationship
            Employee mockEmployeeByEmployeeId = EmployeeTest.CreateMockInstance(tm);

            DataRepository.EmployeeProvider.Insert(tm, mockEmployeeByEmployeeId);
            mock.EmployeeId = mockEmployeeByEmployeeId.EmployeeId;
        }
        ///<summary>
        ///  Returns a Typed JobCandidate Entity with mock values.
        ///</summary>
        static public JobCandidate CreateMockInstance_Generated(TransactionManager tm)
        {
            JobCandidate mock = new JobCandidate();

            mock.Resume       = "<test></test>";
            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Employee mockEmployeeByEmployeeId = EmployeeTest.CreateMockInstance(tm);

            DataRepository.EmployeeProvider.Insert(tm, mockEmployeeByEmployeeId);
            mock.EmployeeId = mockEmployeeByEmployeeId.EmployeeId;

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

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


            return((JobCandidate)mock);
        }
Exemple #8
0
        ///<summary>
        ///  Update the Typed EmployeeDepartmentHistory Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance_Generated(TransactionManager tm, EmployeeDepartmentHistory mock)
        {
            mock.EndDate      = TestUtility.Instance.RandomDateTime();
            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Department mockDepartmentByDepartmentId = DepartmentTest.CreateMockInstance(tm);

            DataRepository.DepartmentProvider.Insert(tm, mockDepartmentByDepartmentId);
            mock.DepartmentId = mockDepartmentByDepartmentId.DepartmentId;

            //OneToOneRelationship
            Employee mockEmployeeByEmployeeId = EmployeeTest.CreateMockInstance(tm);

            DataRepository.EmployeeProvider.Insert(tm, mockEmployeeByEmployeeId);
            mock.EmployeeId = mockEmployeeByEmployeeId.EmployeeId;

            //OneToOneRelationship
            Shift mockShiftByShiftId = ShiftTest.CreateMockInstance(tm);

            DataRepository.ShiftProvider.Insert(tm, mockShiftByShiftId);
            mock.ShiftId = mockShiftByShiftId.ShiftId;
        }
Exemple #9
0
        ///<summary>
        ///  Update the Typed SalesPerson Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance_Generated(TransactionManager tm, SalesPerson mock)
        {
            mock.SalesQuota    = TestUtility.Instance.RandomShort();
            mock.Bonus         = TestUtility.Instance.RandomShort();
            mock.CommissionPct = TestUtility.Instance.RandomShort();
            mock.SalesYtd      = TestUtility.Instance.RandomShort();
            mock.SalesLastYear = TestUtility.Instance.RandomShort();
            mock.ModifiedDate  = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Employee mockEmployeeBySalesPersonId = EmployeeTest.CreateMockInstance(tm);

            DataRepository.EmployeeProvider.Insert(tm, mockEmployeeBySalesPersonId);
            mock.SalesPersonId = mockEmployeeBySalesPersonId.EmployeeId;

            int count1 = 0;
            TList <SalesTerritory> _collection1 = DataRepository.SalesTerritoryProvider.GetPaged(tm, 0, 10, out count1);

            //_collection1.Shuffle();
            if (_collection1.Count > 0)
            {
                mock.TerritoryId = _collection1[0].TerritoryId;
            }
        }
Exemple #10
0
        ///<summary>
        ///  Returns a Typed EmployeePayHistory Entity with mock values.
        ///</summary>
        static public EmployeePayHistory CreateMockInstance_Generated(TransactionManager tm)
        {
            EmployeePayHistory mock = new EmployeePayHistory();

            mock.RateChangeDate = TestUtility.Instance.RandomDateTime();
            mock.Rate           = TestUtility.Instance.RandomShort();
            mock.PayFrequency   = TestUtility.Instance.RandomByte();
            mock.ModifiedDate   = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Employee mockEmployeeByEmployeeId = EmployeeTest.CreateMockInstance(tm);

            DataRepository.EmployeeProvider.Insert(tm, mockEmployeeByEmployeeId);
            mock.EmployeeId = mockEmployeeByEmployeeId.EmployeeId;

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

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


            return((EmployeePayHistory)mock);
        }