Exemple #1
0
        public IActionResult BMICalculator(BMI bmi)
        {
            if (bmi.Metres > 140)
            {
                bmi.BMICalculateMetric();
            }
            else if (bmi.Feet > 4 && bmi.Stones > 6)
            {
                bmi.BMICalculateImperial();
            }
            else
            {
                ViewBag.Error = "You have entered values too small for an adult >_>";
                return(View());
            }

            double bmiResult = bmi.BMIResult;

            return(RedirectToAction("HealthMessage", new { bmiResult }));
        }
        public void TestUnderweightLowestImperial()
        {
            // Arrange

            BMI calculator = new BMI();

            calculator.Stones = 0;
            calculator.Pounds = 0;

            calculator.Feet   = 5;
            calculator.Inches = 11;

            // Act

            calculator.BMICalculateImperial();

            double expectedDistance = 0;

            // Assert
            double Answer = Math.Round(calculator.BMIResult, 2);

            Assert.AreEqual(expectedDistance, Answer);
        }