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)); }
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)); }
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])); } } }
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)); }
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)); }
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)); }
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); }