Ejemplo n.º 1
0
 public void TestQuadNoNegativeSides()
 {
     Quadrilateral myquad = new Quadrilateral();
     myquad.Top = 2;
     myquad.Right = 2;
     myquad.Left = -2;
     myquad.Bottom = 2;
 }
Ejemplo n.º 2
0
 public void TestQuadCanComputePerimeter()
 {
     Quadrilateral myquad = new Quadrilateral();
     myquad.Top = 2;
     myquad.Right = 2;
     myquad.Left = 2;
     myquad.Bottom = 2;
     Assert.AreEqual(8, myquad.Perimeter());
 }
Ejemplo n.º 3
0
 public void TestQuadCanComputeArea()
 {
     Quadrilateral myquad = new Quadrilateral();
     myquad.Top = 3;
     myquad.Right = 3;
     myquad.Left = 3;
     myquad.Bottom = 3;
     Assert.AreEqual(9, myquad.Area());
 }
Ejemplo n.º 4
0
 public void QuadScalingUpTest()
 {
     Quadrilateral myquad = new Quadrilateral(2, 2, 2, 2);
     myquad.Scale(50);
     Assert.AreEqual(3, myquad.Top);
     Assert.AreEqual(3, myquad.Bottom);
     Assert.AreEqual(3, myquad.Left);
     Assert.AreEqual(3, myquad.Right);
 }
Ejemplo n.º 5
0
 public void TestQuadrilateralCanComputePerimeter()
 {
     Quadrilateral myQuadrilateral = new Quadrilateral();
     myQuadrilateral.Top = 2;
     myQuadrilateral.Right = 4;
     myQuadrilateral.Bottom = 99;
     myQuadrilateral.Left = 6;
     Assert.AreEqual(myQuadrilateral.Perimeter(), 111);
 }
Ejemplo n.º 6
0
 public void QuadScaleDownTest()
 {
     //negative scalinhg
     Quadrilateral myquad = new Quadrilateral(10, 10, 10, 10);
     myquad.Scale(-50);
     Assert.AreEqual(5, myquad.Top);
     Assert.AreEqual(5, myquad.Bottom);
     Assert.AreEqual(5, myquad.Left);
     Assert.AreEqual(5, myquad.Right);
 }
Ejemplo n.º 7
0
 public void TestQuadPerimetersAreTheSame()
 {
     Quadrilateral myquad1 = new Quadrilateral();
     myquad1.Top = 2;
     myquad1.Right = 2;
     myquad1.Left = 2;
     myquad1.Bottom = 2;
     Quadrilateral myquad2 = new Quadrilateral(2, 2, 2, 2);
     Assert.AreEqual(myquad1.Perimeter(), myquad2.Perimeter());
 }
Ejemplo n.º 8
0
 public void QuadScaleDownTest()
 {
     // Negative scaling
     // Likewise, 10 - 5 (50% of 10) = 5
     Quadrilateral myquad = new Quadrilateral(10, 10, 10, 10);
     myquad.Scale(-50);
     Assert.AreEqual(5, myquad.Top);
     Assert.AreEqual(5, myquad.Bottom);
     Assert.AreEqual(5, myquad.Left);
     Assert.AreEqual(5, myquad.Right);
 }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            var quad1 = new Quadrilateral(27, 13, 42, 22);

            quad1.FindPerimeter();

            var rect1 = new Rectangle(27, 13);

            rect1.FindPerimeter();
            rect1.FindArea();

            var sq1 = new Square(27);

            sq1.FindPerimeter();
            sq1.FindArea();
        }
Ejemplo n.º 10
0
        public List <IShape> CreateShapes()
        {
            List <IShape> shapes = new List <IShape>();

            Triangle      equilateral = new Triangle(2, 5, 5, 5);
            Triangle      scalene     = new Triangle(2, 4, 6, 8);
            Triangle      isosceles   = new Triangle(2, 10, 5, 5);
            Quadrilateral square      = new Quadrilateral(3, 3);
            Quadrilateral rectangle   = new Quadrilateral(4, 2);
            Circle        circle      = new Circle(2);

            shapes.Add(equilateral);
            shapes.Add(scalene);
            shapes.Add(isosceles);
            shapes.Add(square);
            shapes.Add(rectangle);
            shapes.Add(circle);

            return(shapes);
        }
Ejemplo n.º 11
0
 public void TestQuadNoNegativeSidesInConstructor()
 {
     Quadrilateral myquad = new Quadrilateral(2, -2, 2, 2);
 }
Ejemplo n.º 12
0
 public void TestQuadHasDefaultSize()
 {
     Quadrilateral myquad = new Quadrilateral();
     myquad.Perimeter();
 }
Ejemplo n.º 13
0
 public void TestQuadCanComputePerimeter2()
 {
     Quadrilateral myquad = new Quadrilateral(2, 2, 2, 2);
     Assert.AreEqual(8, myquad.Perimeter());
 }
Ejemplo n.º 14
0
 public void InvalidScaleArgument()
 {
     Quadrilateral myquad = new Quadrilateral(2, 2, 2, 2);
     myquad.Scale(0);
 }
Ejemplo n.º 15
0
 public void TestQuadCanComputeArea()
 {
     Quadrilateral myquad = new Quadrilateral();
     myquad.Area();
 }
Ejemplo n.º 16
0
 public void QuadrilateralCanGetSideLength()
 {
     Quadrilateral myQuadrilateral = new Quadrilateral();
     myQuadrilateral.Top = 2;
     Assert.AreEqual(myQuadrilateral.Top, 2);
 }