コード例 #1
0
        public void CalculateTest(double firstValue, double expected)
        {
            var calculator   = new SquareCalculator();
            var actualResult = calculator.Calculate(firstValue);

            Assert.AreEqual(expected, actualResult, 0.0001);
        }
コード例 #2
0
        public void CalculateTest(double firstArgument, double expectedResult)
        {
            var calculator   = new SquareCalculator();
            var actualResult = calculator.Calculate(firstArgument);

            Assert.AreEqual(expectedResult, actualResult, 0.001);
        }
コード例 #3
0
        void CalcTests(double testnum)
        {
            SquareCalculator sqare = new SquareCalculator();
            double           expResult = Math.Abs(testnum), actResult = sqare.Calculate(testnum);

            Assert.AreEqual(expResult, actResult);
        }
コード例 #4
0
        public void TheSquareOf15Is225()
        {
            // Arrange
            var calculator = new SquareCalculator(1);
            var log        = new CalculationLog();

            // Act
            calculator.Calculate(15, log);

            // Assert
            log.Items.Single().Result.Should().Be(225);
        }
コード例 #5
0
        public void Calculate_Circle_ReturnsCircleSquare()
        {
            // Arrange.
            var radius         = 10;
            var figure         = new Circle(radius);
            var expectedResult = Math.PI * Math.Pow(radius, 2);

            var calculator = new SquareCalculator();

            // Act.
            var result = calculator.Calculate(figure);

            // Assert.
            Assert.AreEqual(expectedResult, result);
        }
コード例 #6
0
        public void Calculate_Triangle_ReturnsTriangleSquare()
        {
            // Arrange.
            var sidesLengths = new List <double> {
                3, 4, 5
            };
            var figure         = Triangle.FromSidesLengths(sidesLengths);
            var expectedResult = 6;

            var calculator = new SquareCalculator();

            // Act.
            var result = calculator.Calculate(figure);

            // Assert.
            Assert.AreEqual(expectedResult, result);
        }