Пример #1
0
        public void CreateCircleByRadiusMethodTest(double r)
        {
            // Arrange & Act
            ICircle circle = null;

            Assert.DoesNotThrow(() => circle = ShapeFactory.CreateCircleByRadius(r));

            // Assert
            Assert.AreEqual(circle.R, r);
        }
        public void AreaMethodTest(double circleRadius, double expectedArea)
        {
            // Arrange
            var circle = ShapeFactory.CreateCircleByRadius(circleRadius);

            // Act
            var circleArea = Math.Round(circle.Area(), 5);

            // Assert
            Assert.AreEqual(expectedArea, circleArea);
        }
        public void ToEllipseMethodTest(double circleRadius)
        {
            // Arrange
            var circle = ShapeFactory.CreateCircleByRadius(circleRadius);

            // Act
            var ellipse = circle.ToEllipse();

            // Assert
            Assert.IsTrue(ellipse != null);
            Assert.AreEqual(circleRadius, ellipse.R1);
            Assert.AreEqual(circleRadius, ellipse.R2);
        }
Пример #4
0
 public void CreateCircleByRadiusMethodTest_2(double r)
 {
     // Arrange & Act & Assert
     Assert.Throws <ArgumentException>(() => ShapeFactory.CreateCircleByRadius(r));
 }