Ejemplo n.º 1
0
        /// <summary>
        /// William Clark
        /// Created: 2021/03/04
        ///
        /// Updates the current routine in the data store, then udpates the interface to reflect the changes
        /// </summary>
        ///
        /// <remarks>
        /// </remarks>
        private void btnSaveRoutineDescription_Click(object sender, RoutedEventArgs e)
        {
            Routine newRoutine = new Routine(txtRoutineName.Text, txtRoutineDescription.Text, _routine.UserAccountID_Client, _routine.UserAccountID_Admin, _routine.Active, _routine.EntryDate, DateTime.Now, null);

            try
            {
                if (_routineManager.UpdateRoutine(_routine, newRoutine))
                {
                    try
                    {
                        _routine = new RoutineVM(newRoutine, _routineManager.GetRoutineStepsByRoutine(newRoutine));
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("The Steps of the routine could not be loaded.");
                    }
                }
                else
                {
                    MessageBox.Show("The Routine could not be updated.");
                }
                PopulatePage();
            }
            catch (Exception)
            {
                MessageBox.Show("The routine could not be updated.");
            }
        }
        public void TestGetRoutineStepsByRoutineReturnsRoutineStepList()
        {
            // Arrange
            int expectedResult = 3;
            List <RoutineStep> actualResult;

            // Act
            actualResult = _routineManager.GetRoutineStepsByRoutine(arbitraryValidRoutine);

            // Assert
            Assert.AreEqual(expectedResult, actualResult.Count);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// William Clark
 /// Created: 2021/02/24
 ///
 /// Constructs an CompleteRoutine
 /// </summary>
 ///
 /// <remarks>
 /// </remarks>
 ///
 /// <param name="routineManager">The RoutineManager Reference</param>
 /// <param name="routine">The Routine to be completed</param>
 /// <param name="user">The UserAccount which will complete the Routine</param>
 public CompleteRoutine(IRoutineManager routineManager, Routine routine, UserAccount user)
 {
     this._routineManager = routineManager;
     this._user           = user;
     try
     {
         this._routine = new RoutineVM(routine, _routineManager.GetRoutineStepsByRoutine(routine));
     }
     catch (Exception)
     {
         MessageBox.Show("The Routine steps could not be loaded.");
     }
     _currentRoutineStep = 0;
     InitializeComponent();
 }