public void MyTestMethod(double height, char sex, double expected)
        {
            WeightCalculator weightCalculator = new WeightCalculator
            {
                Height = height,
                Sex    = sex
            };

            var actual = weightCalculator.GetIdealBodyWeight();

            actual.Should().Be(expected);
        }
        public void WorkingWith_Data_Driven_Tests(double height, char sex, double expected)
        {
            WeightCalculator weightCalculator = new WeightCalculator
            {
                Height = height,
                Sex    = sex
            };

            var actual = weightCalculator.GetIdealBodyWeight();

            actual.Should().Be(expected);
        }
Beispiel #3
0
        public void GetIdealBodyWeight_Gender_B_And_Height_180_return_0()
        {
            //Arrange
            WeightCalculator sut = new WeightCalculator {
                Gender = 'b', Height = 180
            };

            //Act
            double actual   = sut.GetIdealBodyWeight();
            double expected = 0;

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void GetIdealBodyWeight_WithBadSex_And_Height_180_Throw_Exception()
        {
            // Arrange
            WeightCalculator sut = new WeightCalculator
            {
                Sex    = 'r',
                Height = 180
            };

            // Act
            double actual   = sut.GetIdealBodyWeight();
            double expected = 0;

            // Assert
            Assert.AreEqual(expected, actual);
        }
        public void GetIdealBodyWeight_WithSex_W_And_Height_180_Return_65()
        {
            // Arrange
            WeightCalculator sut = new WeightCalculator
            {
                Sex    = 'w',
                Height = 180
            };

            // Act
            double actual   = sut.GetIdealBodyWeight();
            double expected = 65;

            // Assert
            Assert.AreEqual(expected, actual);
        }