Пример #1
0
        public void Good_20()
        {
            var            item      = createStrengthTrainingItem(ExerciseType.Klatka, "8x165", "8x181", "8x197", "4x");
            SerieValidator validator = new SerieValidator();
            var            wrongSets = validator.GetIncorrectSets(item);

            Assert.AreEqual(0, wrongSets.Count);
        }
Пример #2
0
        public void Good_19()
        {
            var            item      = createStrengthTrainingItem(ExerciseType.Klatka, "15x30", "15x50", "15x70", "15x120");
            SerieValidator validator = new SerieValidator();
            var            wrongSets = validator.GetIncorrectSets(item);

            Assert.AreEqual(0, wrongSets.Count);
        }
Пример #3
0
        public void Good_18()
        {
            var            item      = createStrengthTrainingItem(ExerciseType.Nogi, "15x140", "15x", "15x240", "15x240", "15x240", "15x240", "15x240");
            SerieValidator validator = new SerieValidator();
            var            wrongSets = validator.GetIncorrectSets(item);

            Assert.AreEqual(0, wrongSets.Count);
        }
Пример #4
0
        public void Good_16()
        {
            var            item      = createStrengthTrainingItem(ExerciseType.Barki, "12x40", "10x50", "7x60", "7x60", "7x60", "6x62,5");
            SerieValidator validator = new SerieValidator();
            var            wrongSets = validator.GetIncorrectSets(item);

            Assert.AreEqual(0, wrongSets.Count);
        }
Пример #5
0
        public void Good_2()
        {
            var            item      = createStrengthTrainingItem(ExerciseType.Klatka, "5x20", "5x20", "5x28", "3x42", "2x54", "4x56", "5x70", "5x70", "5x70");
            SerieValidator validator = new SerieValidator();
            var            wrongSets = validator.GetIncorrectSets(item);

            Assert.AreEqual(0, wrongSets.Count);
        }
Пример #6
0
        public void Wrong_7()
        {
            var            item      = createStrengthTrainingItem(ExerciseType.Klatka, "8x300", "8x30", "8x30", "8x30");
            SerieValidator validator = new SerieValidator();
            var            wrongSets = validator.GetIncorrectSets(item);

            Assert.AreEqual(1, wrongSets.Count);
            Assert.AreEqual(300, wrongSets[0].Weight);
        }
Пример #7
0
        protected override bool ValidateBeforeSave()
        {
            var incorrectSets = SerieValidator.GetIncorrectSets(Entry);

            if (incorrectSets.Count > 0)
            {
                StringBuilder builder = new StringBuilder();
                builder.AppendLine(ApplicationStrings.StrengthTraining_MsgIncorrectSetsValidation);
                foreach (var incorrectSet in incorrectSets.GroupBy(x => x.StrengthTrainingItem.Exercise))
                {
                    builder.Append(incorrectSet.Key.DisplayExercise + ": ");
                    foreach (var serieDto in incorrectSet)
                    {
                        builder.Append(serieDto.GetDisplayText() + ", ");
                    }
                    builder.AppendLine();
                }
                if (BAMessageBox.Ask(builder.ToString()) == MessageBoxResult.Cancel)
                {
                    return(false);
                }
            }
            return(true);
        }
        public bool ValidateControl()
        {
            var incorrectSets = SerieValidator.GetIncorrectSets(StrengthTrainingEntry);

            if (incorrectSets.Count > 0)
            {
                StringBuilder builder = new StringBuilder();
                builder.AppendLine("usrStrengthTraining_MsgIncorrectSetsValidation".TranslateStrength());
                foreach (var incorrectSet in incorrectSets.GroupBy(x => x.StrengthTrainingItem.Exercise))
                {
                    builder.Append(incorrectSet.Key.GetLocalizedName() + ": ");
                    foreach (var serieDto in incorrectSet)
                    {
                        builder.Append(serieDto.GetDisplayText(WorkoutPlanOperationHelper.SetDisplayMode.Medium) + ", ");
                    }
                    builder.AppendLine();
                }
                if (BAMessageBox.AskWarningYesNo(builder.ToString()) == MessageBoxResult.No)
                {
                    return(false);
                }
            }
            return(true);
        }