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));
        }
예제 #2
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));
        }
예제 #3
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"));
        }
        public void ReturnsPlanWithName()
        {
            var plan = DiscretePlanGenerator.Generate(options);

            Assert.That(plan.Name, Is.Not.Null);
        }
        public void ReturnsCorrectSets()
        {
            var plan = DiscretePlanGenerator.Generate(options);

            Assert.That(plan.GetSetsForDay(testDate).Count, Is.EqualTo(5));
        }
        public void ReturnsExercisePlan()
        {
            var plan = DiscretePlanGenerator.Generate(options);

            Assert.That(plan is DiscreteExercisePlan);
        }