Esempio n. 1
0
        private void rdbMetricUnitInput_CheckedChanged(object sender, EventArgs e)
        {
            if (rdbMetricUnitInput.Checked)
            {
                lblHeight.Text = "Height (cm)";
                lblWeight.Text = "Weight (kg)";

                bmiCalculator           = MetricCalculator.GetInstance(employee);
                lblHeightFt.Visible     = false;
                lblHeightIn.Visible     = false;
                txtHeightInches.Visible = false;
            }
        }
Esempio n. 2
0
        public void MetricCalculator_Test(double height, double weight, double expectedBmi)
        {
            Employee emp = new Employee();

            emp.Name   = "Test";
            emp.Height = height;
            emp.Weight = weight;
            BMICalculator calculator = MetricCalculator.GetInstance(emp);

            string bmi = calculator.CalculateBMI().ToString("f2");

            calculator.CalculateWeight(calculator.BMI);

            Assert.Multiple(() =>
            {
                Assert.AreEqual(calculator.unit, "kg", "Check unit");
                Assert.AreEqual(calculator.Type, UnitTypes.Metric, "Check unit Type");
                Assert.AreEqual(bmi, expectedBmi.ToString("f2"), "Check BMI");
            });
        }