public void TimeSlotExerciseViewModel_Title_Is_Populated_When_Initialized()
        {
            PracticeRoutineTimeSlot timeSlot          = EntityFactory.GetSingleTimeSlot();
            TimeSlotViewModel       timeSlotViewModel = new TimeSlotViewModel(timeSlot);
            TimeSlotExercise        timeSlotExercise  = EntityFactory.GetTimeSlotExercise();

            TimeSlotExerciseViewModel viewModel = new TimeSlotExerciseViewModel(timeSlotExercise, timeSlotViewModel);

            Assert.AreEqual("Existing Exercise", viewModel.Title);
        }
        public void TimeSlotExerciseViewModel_Exposes_TimeSlotExercise()
        {
            PracticeRoutineTimeSlot timeSlot          = EntityFactory.GetSingleTimeSlot();
            TimeSlotViewModel       timeSlotViewModel = new TimeSlotViewModel(timeSlot);
            TimeSlotExercise        timeSlotExercise  = EntityFactory.GetTimeSlotExercise();

            TimeSlotExerciseViewModel viewModel = new TimeSlotExerciseViewModel(timeSlotExercise, timeSlotViewModel);

            Assert.IsNotNull(viewModel.TimeSlotExercise);
            Assert.AreEqual(timeSlot[0].Title, viewModel.TimeSlotExercise.Title);
        }
示例#3
0
        public void TimeSlotViewModel_Edit_TimeSlotViewModel_Raises_ItemChanged()
        {
            var listChanged = false;
            TimeSlotViewModel         viewModel   = new TimeSlotViewModel(GetBasicTimeSlot());
            TimeSlotExerciseViewModel anyExercise = viewModel.Exercises[0];

            viewModel.Exercises.ListChanged += (s, e) => listChanged = true;

            anyExercise.FrequencyWeighting = 1;

            Assert.IsTrue(listChanged);
        }
示例#4
0
        public void TimeSlotViewModel_Remove_TimeSlotViewModel_Raises_ItemChanged()
        {
            var listChanged = false;
            TimeSlotViewModel         viewModel = new TimeSlotViewModel(GetBasicTimeSlot());
            TimeSlotExerciseViewModel first     = viewModel.Exercises[0];

            viewModel.Exercises.ListChanged += (s, e) => listChanged = true;

            viewModel.SelectedExercise = first;

            viewModel.Exercises.Remove(first);

            Assert.IsTrue(listChanged);
        }
示例#5
0
        public void TimeSlotViewModel_Remove_TimeSlot_Actually_Removes_TimeSlot()
        {
            TimeSlotViewModel         viewModel = new TimeSlotViewModel(GetBasicTimeSlot());
            TimeSlotExerciseViewModel first     = viewModel.Exercises[0];

            viewModel.SelectedExercise = first;

            var beforeCount = viewModel.Exercises.Count;

            viewModel.Exercises.Remove(first);
            var afterCount = viewModel.Exercises.Count;

            Assert.AreEqual(beforeCount - 1, afterCount);
        }
        public void TimeSlotExerciseViewModel_FrequencyWeighting_Set_Fires_PropertyChanged()
        {
            var fired = false;
            PracticeRoutineTimeSlot timeSlot          = EntityFactory.GetSingleTimeSlot();
            TimeSlotViewModel       timeSlotViewModel = new TimeSlotViewModel(timeSlot);
            TimeSlotExercise        timeSlotExercise  = EntityFactory.GetTimeSlotExercise();

            TimeSlotExerciseViewModel viewModel = new TimeSlotExerciseViewModel(timeSlotExercise, timeSlotViewModel);

            viewModel.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "FrequencyWeighting")
                {
                    fired = true;
                }
            };
            viewModel.FrequencyWeighting = 4;

            Assert.IsTrue(fired);
        }