Exemple #1
0
        public void Verify_That_Area_Is_Calculated_Accurately()
        {
            Pentagon pentagon             = new Pentagon();
            double   sideLength           = 7d;
            double   minimumValuePossible = 84.29d;
            double   maximumValuePossible = 84.31d;

            pentagon.SideLength = sideLength;

            pentagon.Area().ShouldBeInRange(minimumValuePossible, maximumValuePossible);
        }
Exemple #2
0
        private static void TellAboutThePentagon(double lengthOfSide)
        {
            var pentagon = new Pentagon();

            Console.WriteLine(pentagon.Description());
            pentagon.SideLength = lengthOfSide;
            Console.WriteLine($"Number of Sides = {pentagon.NumberOfSides}");
            Console.WriteLine($"Length of the Sides = {pentagon.SideLength}");
            Console.WriteLine($"Perimeter of the shape = {pentagon.Perimeter()}");
            Console.WriteLine($"Area of the shape = {pentagon.Area()}");
        }
        public void Verify_The_Area_Is_Calculated_Accurately()
        {
            Pentagon pentagon   = new Pentagon();
            double   sideLength = 5.6d;
            double   expectedAreaMinAcceptable = 27d;
            double   expectedAreaMaxAcceptable = 29d;

            pentagon.SideLength = sideLength;

            pentagon.Area().ShouldBeInRange(expectedAreaMinAcceptable, expectedAreaMaxAcceptable);
        }
        public void Verify_The_Area_Is_Calculated_Accurately()
        {
            // Arrange
            var pentagon   = new Pentagon();
            var sideLength = 5.6d; //resulting area = approx 53.95
            var expectedAreaMinimumAcceptable = 53.945d;
            var expectedAreaMaximumAcceptable = 53.955d;

            // Act
            pentagon.SideLength = sideLength;

            // Assert
            pentagon.Area().ShouldBeInRange(expectedAreaMinimumAcceptable, expectedAreaMaximumAcceptable);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Ethan Smith Demonstrator_1");
            Console.WriteLine();

            var triangle = new Triangle {
                SideLength = 123.456
            };

            Console.WriteLine(triangle.Description());
            Console.WriteLine($"Number of Sides = {triangle.NumberOfSides}");
            Console.WriteLine($"Length of the Sides = {triangle.SideLength}");
            Console.WriteLine($"Perimeter of the shape = {triangle.Perimeter()}");
            Console.WriteLine($"Area of the shape = {triangle.Area()}");

            Console.WriteLine();

            var square = new Square {
                SideLength = 321.654
            };

            Console.WriteLine(square.Description());
            Console.WriteLine($"Number of Sides = {square.NumberOfSides}");
            Console.WriteLine($"Length of the Sides = {square.SideLength}");
            Console.WriteLine($"Perimeter of the shape = {square.Perimeter()}");
            Console.WriteLine($"Area of the shape = {square.Area()}");

            Console.WriteLine();

            var pentagon = new Pentagon {
                SideLength = 1.123
            };

            Console.WriteLine(pentagon.Description());
            Console.WriteLine($"Number of Sides = {pentagon.NumberOfSides}");
            Console.WriteLine($"Length of the Sides = {pentagon.SideLength}");
            Console.WriteLine($"Perimeter of the shape = {pentagon.Perimeter()}");
            Console.WriteLine($"Area of the shape = {pentagon.Area()}");

            Console.WriteLine();
            Console.WriteLine("Press any key to continue");
            Console.ReadKey();
        }
Exemple #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("Spencer Johnson Demonstrator 1");
            Console.WriteLine();

            var triangle = new Triangle();

            triangle.SideLength = 123.456;
            Console.WriteLine(triangle.Description());
            Console.WriteLine($"Number of Sides = {triangle.NumberOfSides}");
            Console.WriteLine($"Length of the Sides = {triangle.SideLength}");
            Console.WriteLine($"Perimeter of the shape = {triangle.Perimeter()}");
            Console.WriteLine($"Area of the shape = {triangle.Area()}");
            Console.WriteLine();

            var square = new Square();

            square.SideLength = 123.456;
            Console.WriteLine(square.Description());
            Console.WriteLine($"Number of Sides = {square.NumberOfSides}");
            Console.WriteLine($"Length of the Sides = {square.SideLength}");
            Console.WriteLine($"Perimeter of the shape = {square.Perimeter()}");
            Console.WriteLine($"Area of the shape = {square.Area()}");
            Console.WriteLine();

            var pentagon = new Pentagon();

            pentagon.SideLength = 123.456;
            Console.WriteLine(pentagon.Description());
            Console.WriteLine($"Number of Sides = {pentagon.NumberOfSides}");
            Console.WriteLine($"Length of the Sides = {pentagon.SideLength}");
            Console.WriteLine($"Perimeter of the shape = {pentagon.Perimeter()}");
            Console.WriteLine($"Area of the shape = {pentagon.Area()}");
            Console.WriteLine();

            Console.WriteLine();
            Console.Write("Press any key to continue");
            Console.ReadKey();
        }