コード例 #1
0
        public void ReturnsReasonableWeights([Range(2, 50)] int sets)
        {
            var weights = DiscretePlanGenerator.WeightGenerator(sets);

            Assert.That(weights[0], Is.EqualTo(1.0).Within(0.004));
            Assert.That(weights[sets - 1], Is.EqualTo(0.3).Within(0.004));
        }
コード例 #2
0
        public void ReturnsProgression()
        {
            var plan = DiscretePlanGenerator.Generate(options);

            var setsDay1 = plan.SetsOfExercise;

            var repsDay1 = plan.GetTotalRepsForDay(testDate.AddDays(1));
            var repsDay2 = plan.GetTotalRepsForDay(testDate.AddDays(2));

            Assert.That(repsDay1, Is.LessThan(repsDay2));
        }
コード例 #3
0
        public void SetsGetEasier([Range(2, 50)] int sets)
        {
            var weights = DiscretePlanGenerator.WeightGenerator(sets);

            for (int i = 0; i < weights.Count; i++)
            {
                if (i != 0)
                {
                    Assert.That(weights[i], Is.LessThan(weights[i - 1]));
                }
            }
        }
コード例 #4
0
        public void ReturnsSetsCorrectTotals(int totalBegin, int sets)
        {
            var exerciseSets = DiscretePlanGenerator.CreateSets(totalBegin, sets);
            int total        = 0;

            foreach (var set in exerciseSets)
            {
                total += set.Repetitions;
            }

            Assert.That(total, Is.EqualTo(totalBegin));
            Assert.That(exerciseSets.Count, Is.EqualTo(sets));
        }
コード例 #5
0
        public void InsertsExercisePlan()
        {
            SetupFakeWithDb();

            var discretePlan = DiscretePlanGenerator.Generate(TestInput.TestOptions);

            profileData.Add(testEmail, discretePlan);

            var profile = profileData.GetByEmailAddress(testEmail);

            var containsGeneratedPlan = profile.DiscreteExercisePlans.ToList().Contains(discretePlan);

            Assert.That(containsGeneratedPlan, Is.True);
            Assert.That(fakeProfile.DiscreteExercisePlans.ToList().Count, Is.EqualTo(2));
        }
コード例 #6
0
        public void ReturnsOnEasier(int first, int second, int third)
        {
            var set = new List <ExerciseSet>()
            {
                new ExerciseSet
                {
                    Repetitions = first
                },
                new ExerciseSet
                {
                    Repetitions = second
                },
                new ExerciseSet
                {
                    Repetitions = third
                }
            };

            Assert.That(DiscretePlanGenerator.SetsGetEasier(set));
        }
コード例 #7
0
        public async Task <IActionResult> PostExercise([FromForm] DiscreteExercisePlanOptions options, [FromForm] ExerciseDays days)
        {
            var body = this.HttpContext.Request.Form;

            options.Days = days;
            if (options == null)
            {
                return(this.StatusCode(500));
            }

            var userEmail = User.FindFirst(ClaimTypes.Name).Value;
            var thisUser  = this.profileData.GetByEmailAddress(userEmail);

            options.Profile = thisUser;
            var exercisePlan = DiscretePlanGenerator.Generate(options);

            profileData.Update(userEmail, exercisePlan);
            profileData.Commit();
            return(LocalRedirect("~/index"));
        }
コード例 #8
0
        public void ReturnsPlanWithName()
        {
            var plan = DiscretePlanGenerator.Generate(options);

            Assert.That(plan.Name, Is.Not.Null);
        }
コード例 #9
0
        public void ReturnsCorrectSets()
        {
            var plan = DiscretePlanGenerator.Generate(options);

            Assert.That(plan.GetSetsForDay(testDate).Count, Is.EqualTo(5));
        }
コード例 #10
0
        public void ReturnsExercisePlan()
        {
            var plan = DiscretePlanGenerator.Generate(options);

            Assert.That(plan is DiscreteExercisePlan);
        }