コード例 #1
0
            public void EllipseParameterizedConstructor()
            {
                var semiMajorAxis = 10;
                var semiMinorAxis = 20;

                sut = new Ellipse(semiMajorAxis, semiMinorAxis);

                Assert.That(sut.CalculatePerimeter(), Is.EqualTo(2 * Math.PI *
                                                                 Math.Sqrt(
                                                                     (Math.Pow(semiMajorAxis, 2) + Math.Pow(semiMinorAxis, 2)) / 2)));
                Assert.That(sut.CalculateArea(), Is.EqualTo(Math.PI * semiMajorAxis * semiMinorAxis));
            }