Esempio n. 1
0
        public void CalculateArea_ReturnsExpectedValue(double radius, double expected)
        {
            // Arrange
            CircleByRadius sut = new CircleByRadius(radius);

            // Act
            double actual = sut.CalculateArea();

            // Assert
            Tolerance.AreEqual(actual, expected).Should().BeTrue();
        }
        public void CalculateArea_ReturnsExpectedValue()
        {
            // Arrange
            TriangleByThreeSides sut = new TriangleByThreeSides(3.0, 4.0, 5.0);

            // Act
            double actual = sut.CalculateArea();

            // Assert
            double expected = 6.0;

            Tolerance.AreEqual(actual, expected).Should().BeTrue();
        }
Esempio n. 3
0
        public void CalculateArea_ReturnsExpectedValue()
        {
            // Arrange
            double formula(IReadOnlyList <double> args) => (args[0] + args[1]) * args[2];

            double[]             arguments = new double[] { 1.0, 2.0, 3.0 };
            CustomAreaCalculator sut       = new CustomAreaCalculator(formula, arguments);

            // Act
            double actual = sut.CalculateArea();

            // Assert
            double expected = 9.0;

            Tolerance.AreEqual(actual, expected).Should().BeTrue();
        }