コード例 #1
0
        public void TestCompoundShapeMath()
        {
            // arrange
            // manually calc sum of perimeters - line + circle + line
            double expectedPerimeterSum = 1 + 18.8495559215387594;
            // manually calc sum of areas - line + circle + line
            double expectedAreaSum = 0 + 28.274333882308139146;

            _compoundShape.Add(_line);
            _compoundShape.Add(_circle);

            // act
            double actualPerimeterSum = _compoundShape.GetPerimeter();
            double actualAreaSum      = _compoundShape.GetArea();

            // assert
            Assert.AreEqual(expectedPerimeterSum, actualPerimeterSum);
            Assert.AreEqual(expectedAreaSum, actualAreaSum);
        }