public void BMInfectionRisk_IntObeseRange_AgeUnder70_HighRiskReturn() { BMI bmi = new BMI() { WeightStones = 45, WeightPounds = 0, HeightFeet = 6, HeightInches = 2 }; int age = 30; Assert.AreEqual(bmi.infectionRiskLevel, InfectionRiskLevel.High); }
public void bmiIsUnderweight() { BMI bmiTest = new BMI(); bmiTest.WeightStones = 7; bmiTest.HeightFeet = 6; bmiTest.HeightInches = 2; Assert.AreEqual(bmiTest.BMICategory, BMICategory.Underweight); }
public static void Main(string[] args) { for (int i = 0; i < 9; i++) { Console.WriteLine("Enter your height:"); double height = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter your weight:"); double weight = Convert.ToDouble(Console.ReadLine()); Console.WriteLine(BMI.BMIResults(BMI.CalculateBMI(height, weight))); } }
public void BMIHttpPost_ReturnsAViewResult_ViewResultIsNotNull_ObjectIsNotNull() { // Arrange HomeController controller = new HomeController(); BMI bmi = new BMI(); // Act ViewResult result = controller.BMI(bmi) as ViewResult; // Assert Assert.IsNotNull(result); }
public void AnalyzeBMI() { Console.Write("I'm a woman. My BMI is {0:0.##} ", BMI.ComputeBMI(weight, height)); if (BMI.ComputeBMI(weight, height) < 16) { Console.Write("so I'm too slim"); } else { Console.Write("so I'm fat"); } }
public IActionResult BMI(BMI bmi) { if (bmi.HeightInMetres > 14) { bmi.MetricFormula(); } else if (bmi.HeightInFeet > 4 && bmi.WeightInStones > 6) { bmi.ImperialFormula(); } return(View()); }
/// <summary> /// add new user to database after register /// </summary> /// <param name="user"></param> public void addNewUser(User user, WeeklyGoal goal) { CalcWeeklyGoal(goal); BMI bMI = new BMI() { User = user, Height = (float)user.Height, Weight = (float)user.Weight, Date = DateTime.Now, }; MyDal.addNewUser(user, goal, bMI); }
public ActionResult FindBMI(BMI model) { var result = WorkflowInvoker.Invoke(new BMIRuleEngine.Workflow1(), new Dictionary <string, object> { { "BMIInput", model.BMIValue } }); model.Recommendation = result["Recomendetion"] as String; TempData["wfResult"] = model; return(RedirectToAction("ShowResult")); }
public static Measurement convertMeasurementToCTXMeasurement(String socialSecurityNumber, BMI.Containers.Measurement measurement) { if (measurement != null && socialSecurityNumber != null) { return new Measurement { SocialSecurityNumber = socialSecurityNumber, Length = measurement.length, Weight = measurement.weight, Date = measurement.date }; } return null; }
public bool addPerson(BMI.Person newPerson) { if (_ctxBMI.People.Count(e => e.SocialSecurityNumber == newPerson.socialSecurityNumber) == 0) { Person personObj = ModelTranslator.convertPersonToCTXPerson(newPerson); if (personObj != null) { _ctxBMI.People.Add(personObj); _ctxBMI.SaveChanges(); return true; } } return false; }
public static Person convertPersonToCTXPerson(BMI.Person person) { if (person != null) { Person retVal = new Person { SocialSecurityNumber = person.socialSecurityNumber, BirthDate = person.birthDate, Gender = person.gender.ToString() }; foreach (BMI.Containers.Measurement measurement in person.measurements) { retVal.Measurements.Add(convertMeasurementToCTXMeasurement(person.socialSecurityNumber, measurement)); } return retVal; } return null; }
public bool addMeasurement(string socialSecurityNumber, BMI.Containers.Measurement newMeasurement) { if (String.IsNullOrEmpty(socialSecurityNumber) || newMeasurement == null) { throw new Exception(); } if (_ctxBMI.People.Count(e => e.SocialSecurityNumber == socialSecurityNumber) != 0) { Measurement measurementObj = ModelTranslator.convertMeasurementToCTXMeasurement(socialSecurityNumber, newMeasurement); if (measurementObj != null) { _ctxBMI.Measurements.Add(measurementObj); _ctxBMI.SaveChanges(); return true; } } return false; }