Beispiel #1
0
        public void TestTriangle()
        {
            IFigureFactorory figureFactory = new TriangleFactory(3, 4, 5);
            IFigure          figure        = figureFactory.Create();

            Assert.AreEqual(Math.Round(figure.Square), 6);
        }
Beispiel #2
0
        public void Create_ShouldReturnIFigure(string name, double[] sides)
        {
            var factory = new TriangleFactory(name, sides[0], sides[1], sides[2]);

            //assert
            Assert.IsAssignableFrom <IFigure>(factory.Create());
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Descubra qual é o tipo do triangulo!");
            Console.WriteLine("Informe os tres lados que compoem seu triangulo:");

            Console.Write("O primeiro lado: ");
            var firstSide = double.Parse(Console.ReadLine());

            Console.Write("O segundo lado: ");
            var secondSide = double.Parse(Console.ReadLine());

            Console.Write("O terciero e ultimo lado: ");
            var thirdSide = double.Parse(Console.ReadLine());

            var threeSides = new ThreeSides(firstSide, secondSide, thirdSide);

            var triangleFactory        = new TriangleFactory();
            var triangleTypeCalculator = new TriangleTypeCalculator();
            var triangle = triangleFactory.Create(threeSides, triangleTypeCalculator);

            Console.WriteLine(triangle.Types);
        }
    public static void Main()
    {
        var factory = new TriangleFactory();

        var triangle = factory.Create();
    }