示例#1
0
        public void SuperSet_NegativeSets_UseDefault()
        {
            var pushups = new BodyWeightExercise("Pushups", 5, 20);
            var sSet    = new SuperSet("Name", -3, pushups, pushups);

            Assert.AreEqual(0, sSet.Cycles);
        }
示例#2
0
        public void SuperSet_PassingNull_UseDefaults()
        {
            var sSet = new SuperSet(null, 3, null, null);

            Assert.AreEqual("Nameless Super Set", sSet.Name);
            Assert.IsNull(sSet.First);
            Assert.IsNull(sSet.Second);
        }
示例#3
0
        public void SuperSet_CheckDefaults_HappyPath()
        {
            var pushups = new BodyWeightExercise("Pushups", 5, 20);
            var pullups = new BodyWeightExercise("Pullups", 5, 5);
            var sSet    = new SuperSet("SuperSet", 3, pushups, pullups);

            Assert.AreEqual("SuperSet", sSet.Name);
            Assert.AreEqual(3, sSet.Cycles);
            Assert.AreEqual(pushups, sSet.First);
            Assert.AreEqual(pullups, sSet.Second);
        }
示例#4
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(nameTb.Text) && (!string.IsNullOrWhiteSpace(infoTb.Text)) &&
                (supersetExcLb.Items.Count > 0))
            {
                Superset      = new SuperSet();
                Superset.Name = nameTb.Text;
                Superset.Info = infoTb.Text;

                foreach (object i in supersetExcLb.Items)
                {
                    Superset.ExcercisesList.Add((Excercise)i);
                }

                DialogResult = true;
                Close();
            }
        }
        private void mnuJoinSuperSet_Click(object sender, EventArgs e)
        {
            TrainingPlanDay day = null;

            foreach (ListViewItem selectedItem in exercisesTrainingPlanListView1.SelectedItems)
            {
                TrainingPlanEntry entry = (TrainingPlanEntry)selectedItem.Tag;
                if (day != null && entry.Day != day)
                {
                    FMMessageBox.ShowError(StrengthTrainingEntryStrings.ErrorCannotCreateSuperSetDifferentDays);
                    return;
                }
                day = entry.Day;
            }

            foreach (ListViewItem selectedItem in exercisesTrainingPlanListView1.SelectedItems)
            {
                TrainingPlanEntry entry = (TrainingPlanEntry)selectedItem.Tag;
                var superSet            = day.GetSuperSet(entry);
                if (superSet != null)
                {
                    superSet.SuperSets.Remove(entry);
                }
            }

            SuperSet newSet = new SuperSet();

            foreach (ListViewItem selectedItem in exercisesTrainingPlanListView1.SelectedItems)
            {
                TrainingPlanEntry entry = (TrainingPlanEntry)selectedItem.Tag;
                newSet.SuperSets.Add(entry);
            }
            day.SuperSets.Add(newSet);

            //clear empty supersets or with only one exercise
            TrainingPlanChecker checker = new TrainingPlanChecker();

            checker.Process(plan);

            exercisesTrainingPlanListView1.Fill(plan);
        }