Example #1
0
        public void Should_ThrowArgumentException_When_WeightIsZero()
        {
            // [arrange]
            var underTest = new BmiReport();

            // [act]
            underTest.GetBmiIndex(150, 0d);
        }
Example #2
0
        public void Should_RoundToOneFloatingPoint_WhenIndexHasMoreThenOneDecimalPlaces()
        {
            // [arrange]
            var height = 1.77;
            var weight = 70d;

            var underTest = new BmiReport();

            // [act]
            var result = underTest.GetBmiIndex(height, weight);

            // [assert]
            //Has only one digit after floating point
            Assert.AreEqual(0, (result * 100) % 10);
        }
Example #3
0
        public void Should_ReturnValidBmiIndex_When_WeightAndHeightAreNotZero()
        {
            // [arrange]
            var height        = 1.60;
            var weight        = 50d;
            var expectedIndex = 19.5;

            var underTest = new BmiReport();

            // [act]
            var result = underTest.GetBmiIndex(height, weight);

            // [assert]
            Assert.AreEqual(expectedIndex, result);
        }