Provides tests for the and Department objects (entity, collection and repository).
Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        ///<summary>
        ///  Update the Typed Department Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, Department mock)
        {
            DepartmentTest.UpdateMockInstance_Generated(tm, mock);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);
        }
Ejemplo n.º 3
0
        ///<summary>
        ///  Returns a Typed Department Entity with mock values.
        ///</summary>
        static public Department CreateMockInstance(TransactionManager tm)
        {
            // get the default mock instance
            Department mock = DepartmentTest.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);
        }
Ejemplo n.º 4
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;
        }