コード例 #1
0
ファイル: CircleTests.cs プロジェクト: olexandr17/kottans
        public void ShouldConvertToString()
        {
            // declare
            const double radius = 5d;

            IShape circle = new Circle(radius);
            // act
            var info = circle.ToString();
            // assert
            info.Should().Be($"Shape information: Name : {"Circle"}, X : {0}, Y : {0}, Perimeter : {2*radius*Math.PI}, Square : {radius*radius*Math.PI}");
        }
コード例 #2
0
        public void ShouldGetInfoWithMultiplier()
        {
            // declare
            const double radius = 5d;
            const byte multiplier = 2;

            IShape circle = new Circle(radius)
            {
                Multiplier = multiplier
            };
            // act
            var info = circle.ToString();
            // assert
            info.Should().Be($"Shape information: Name : {"Circle"}, X : {0}, Y : {0}, Perimeter : { multiplier * 2 * radius * Math.PI}, Square : {multiplier * multiplier * radius * radius * Math.PI}");
        }
コード例 #3
0
        public void ShouldConvertToString()
        {
            // Arrange
            const double radius = 5d;

            IShape circle = new Circle(radius);

            // Act
            var info = circle.ToString();

            // Assert
            info.Should().Be("Shape information:\r\n" +
                            $"Name: {"Circle"}\r\n" +
                            $"X: {0}\r\n" +
                            $"Y: {0}\r\n" +
                            $"Perimeter: { 2 * radius * Math.PI:F2}\r\n" +
                            $"Area: {radius*radius*Math.PI:F2}");
        }
コード例 #4
0
        public void ShouldGetInfoWithMultiplier()
        {
            // Arrange
            const double radius = 5d;
            const byte multiplier = 2;

            IShape circle = new Circle(radius)
            {
                Multiplier = multiplier
            };

            // Act
            var info = circle.ToString();

            // Assert
            info.Should().Be("Shape information:\r\n" +
                             $"Name: {"Circle"}\r\n" +
                             $"X: {0}\r\n" +
                             $"Y: {0}\r\n" +
                             $"Perimeter: { multiplier * 2 * radius * Math.PI:F2}\r\n" +
                             $"Area: {multiplier * multiplier * radius * radius * Math.PI:F2}");
        }