예제 #1
0
        public void SelectShiftTimesByDepartmentID()
        {
            IShiftTimeManager           shiftTimeManager = new ShiftTimeManager(_shiftTimeAccessor);
            List <PetUniverseShiftTime> times;

            times = shiftTimeManager.RetrieveShiftTimesByDepartment("Sales");

            Assert.AreEqual(1, times.Count);
        }
예제 #2
0
        public void TestShiftTimeManagerRetrieveShiftTimes()
        {
            //arrange
            List <PetUniverseShiftTime> shifTimes;
            IShiftTimeManager           shiftTimeManager = new ShiftTimeManager(_shiftTimeAccessor);

            //act
            shifTimes = shiftTimeManager.RetrieveShiftTimes();

            //assert
            Assert.AreEqual(1, shifTimes.Count);
        }
예제 #3
0
        public void TestShiftTimeManagerDeactivatetShiftTimeTests()
        {
            //arrange
            int  shiftTimeID = 100001;
            bool test;
            IShiftTimeManager shiftTimeManager = new ShiftTimeManager(_shiftTimeAccessor);
            bool expectedResult = true;

            //act
            test = shiftTimeManager.DeactivateShiftTime(shiftTimeID);

            //assert
            Assert.AreEqual(test, expectedResult);
        }
예제 #4
0
        public void TestShiftTimeManagerInsertShiftTimeTests()
        {
            //arrange
            PetUniverseShiftTime shiftTime = new PetUniverseShiftTime();

            shiftTime.DepartmentID = "Shipping/Receiving";
            shiftTime.StartTime    = "14:00:00";
            shiftTime.EndTime      = "22:00:00";
            bool test;
            IShiftTimeManager shiftTimeManager = new ShiftTimeManager(_shiftTimeAccessor);

            //act
            test = shiftTimeManager.AddShiftTime(shiftTime);

            //assert
            Assert.IsTrue(test);
        }
예제 #5
0
        public void TestSelectShiftTimesByID()
        {
            IShiftTimeManager    shiftTimeManager = new ShiftTimeManager(_shiftTimeAccessor);
            PetUniverseShiftTime time;

            PetUniverseShiftTime target = new PetUniverseShiftTime()
            {
                ShiftTimeID  = 100001,
                DepartmentID = "Sales",
                StartTime    = "08:45:00",
                EndTime      = "5:45:00"
            };

            time = shiftTimeManager.RetrieveShiftTimeByID(100001);

            Assert.AreEqual(target.ShiftTimeID, time.ShiftTimeID);
        }
        /// <summary>
        /// Creator: Jordan Lindo
        /// Created: 2/15/2020
        /// Approver: Alex Diers
        ///
        /// This button click listener sends the data for creating a new department record to the logic layer
        /// </summary>
        /// <remarks>
        /// Updater: NA
        /// Updated: NA
        /// Update: NA
        ///
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddDepartmentSave_Click(object sender, RoutedEventArgs e)
        {
            string departmentID = txtAddDepartmentDepartmentName.Text;
            string description  = txtAddDepartmentDescription.Text;

            if (ValidateERole.checkDepartmentID(departmentID) && ValidateERole.checkDescription(description))
            {
                try
                {
                    if (_departmentManager.AddDepartment(departmentID, description))
                    {
                        ShiftTimeManager _shiftTimeManger = new ShiftTimeManager();
                        try
                        {
                            foreach (PetUniverseShiftTime shiftTime in DEFAULT_SHIFTTIMES)
                            {
                                shiftTime.DepartmentID = departmentID;
                                _shiftTimeManger.AddShiftTime(shiftTime);
                            }
                        }
                        catch (Exception ex)
                        {
                            WPFErrorHandler.ErrorMessage("failed to save departments Default Shift Times. " + ex.Message);
                        }

                        WPFErrorHandler.SuccessMessage("Department added, with default shift times");
                        canAddDepartment.Visibility  = Visibility.Hidden;
                        canDepartmentList.Visibility = Visibility.Visible;
                        showDGDepartments();
                    }
                    else
                    {
                        WPFErrorHandler.ErrorMessage("Department not added.");
                    }
                }
                catch (Exception ex)
                {
                    WPFErrorHandler.ErrorMessage("Department failed to save. " + ex.Message);
                }
            }
예제 #7
0
        public void TestShiftTimeManagerEditShiftTimeTests()
        {
            //arrange
            PetUniverseShiftTime oldShiftTime = new PetUniverseShiftTime();

            oldShiftTime.DepartmentID = "Shipping/Receiving";
            oldShiftTime.StartTime    = "14:00:00";
            oldShiftTime.EndTime      = "22:00:00";

            PetUniverseShiftTime newShiftTime = new PetUniverseShiftTime();

            newShiftTime.DepartmentID = "Shipping/Receiving";
            newShiftTime.StartTime    = "08:00:00";
            newShiftTime.EndTime      = "16:00:00";
            bool test;
            IShiftTimeManager shiftTimeManager = new ShiftTimeManager(_shiftTimeAccessor);

            //act
            test = shiftTimeManager.EditShiftTime(oldShiftTime, newShiftTime);

            //assert
            Assert.IsTrue(test);
        }