Ejemplo n.º 1
0
        public void SaveShapesTest1()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 5));
            shapeBUS.CreateEllipse();

            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 8));
            shapeBUS.AddPoint(new Point(5, 4));
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.CreatePolygon();

            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(3, 50));
            shapeBUS.CreatePolyline();

            shapeBUS.AddPoint(new Point(5, 5));
            shapeBUS.CreatePolyline();

            shapeBUS.SaveShapes("test.xaml");

            var fileText = File.ReadLines("test.xaml");

            Assert.IsTrue(fileText.ToString().Length > 1);
        }
Ejemplo n.º 2
0
        public void CreatePolylineTest_With2Points()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 5));

            shapeBUS.CreatePolyline();
        }
Ejemplo n.º 3
0
        public void CreateEllipseTest4_With2Points()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, -5));

            shapeBUS.CreateEllipse();
        }
Ejemplo n.º 4
0
        public void GetShapesTest1()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 5));

            shapeBUS.CreateEllipse();
            shapeBUS.GetShapes("dd.xaml");
        }
Ejemplo n.º 5
0
        public void CreatePolygonTest_With3Points()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 8));
            shapeBUS.AddPoint(new Point(5, 4));
            shapeBUS.AddPoint(new Point(0, 0));

            shapeBUS.CreatePolygon();
        }
Ejemplo n.º 6
0
        public void NewShapeForCancasTest2()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 5));

            shapeBUS.CreateEllipse();

            CanvasBUS.NewShapeForCancas(shapeBUS.Shapes[0] as EllipseShape);
        }
Ejemplo n.º 7
0
        public void CreatePentagonTest_With5Points()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 5));
            shapeBUS.AddPoint(new Point(6, 5));
            shapeBUS.AddPoint(new Point(9, 5));
            shapeBUS.AddPoint(new Point(15, 5));

            shapeBUS.CreatePentagon();
        }
Ejemplo n.º 8
0
        public void NewShapeForCancasTest1()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 8));
            shapeBUS.AddPoint(new Point(5, 4));
            shapeBUS.AddPoint(new Point(0, 0));

            shapeBUS.CreatePolygon();

            CanvasBUS.NewShapeForCancas(shapeBUS.Shapes[0] as PolygonShape);
        }
Ejemplo n.º 9
0
        public void GetShapesTest1()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 5));
            shapeBUS.AddPoint(new Point(6, 5));
            shapeBUS.AddPoint(new Point(9, 5));
            shapeBUS.AddPoint(new Point(15, 5));

            shapeBUS.CreatePentagon();

            shapeBUS.GetShapes("testing.xaml");
        }
Ejemplo n.º 10
0
        public void NewShapeForCancasTest3()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(3, 50));

            shapeBUS.CreatePolyline();

            shapeBUS.AddPoint(new Point(5, 5));
            shapeBUS.CreatePolyline();

            CanvasBUS.NewShapeForCancas(shapeBUS.Shapes[0] as PolylineShape);
        }
Ejemplo n.º 11
0
        public void RemoveAllPointTest()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 6));
            shapeBUS.AddPoint(new Point(4, 0));

            shapeBUS.RemoveAllPoint();

            int expected = 0;
            int actual   = shapeBUS.Shapes.Count;

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 12
0
        public void FillShapeTest2()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 8));
            shapeBUS.AddPoint(new Point(5, 4));
            shapeBUS.AddPoint(new Point(0, 0));

            shapeBUS.CreatePolygon();

            Color color = Color.FromRgb(255, 255, 255);

            shapeBUS.FillShape(color);
        }
Ejemplo n.º 13
0
        public void MoveShapeTest1()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 8));
            shapeBUS.AddPoint(new Point(5, 4));
            shapeBUS.AddPoint(new Point(0, 0));

            shapeBUS.CreatePolygon();
            shapeBUS.ChooseShape("Polygon 1");

            shapeBUS.SetShapeMarginAndStartMovePoint(new Point(0, 1));
            shapeBUS.MoveShape(new Point(2, 3));
        }
Ejemplo n.º 14
0
        public void FillShapeTest2()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 5));
            shapeBUS.AddPoint(new Point(6, 5));
            shapeBUS.AddPoint(new Point(9, 5));
            shapeBUS.AddPoint(new Point(15, 5));

            shapeBUS.CreatePentagon();

            Color color = Color.FromRgb(255, 255, 255);

            shapeBUS.FillShape(color);
        }
Ejemplo n.º 15
0
        public void ChooseShapeTest()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 6));

            shapeBUS.CreateEllipse();

            shapeBUS.ChooseShape("Ellipse 1");

            int expected = 0;
            int actual   = shapeBUS.ChoosenShapeIndex;

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 16
0
        public void NewShapeForCancasTest4()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));

            CanvasBUS.NewShapeForCancas(shapeBUS.Shapes[0] as PointShape);
        }
Ejemplo n.º 17
0
        public void MoveShapeTest1()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 5));
            shapeBUS.AddPoint(new Point(6, 5));
            shapeBUS.AddPoint(new Point(9, 5));
            shapeBUS.AddPoint(new Point(15, 5));

            shapeBUS.CreatePentagon();

            shapeBUS.ChooseShape("Pentagon_1");

            shapeBUS.SetShapeMarginAndStartMovePoint(new Point(0, 1));
            shapeBUS.MoveShape(new Point(2, 3));
        }
Ejemplo n.º 18
0
        public void FillShapeTest1()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 8));
            shapeBUS.AddPoint(new Point(5, 4));
            shapeBUS.AddPoint(new Point(0, 0));

            shapeBUS.CreatePolygon();

            shapeBUS.ChooseShape("Polygon 1");

            Color color = Color.FromRgb(0, 0, 0);

            shapeBUS.FillShape(color);
        }
Ejemplo n.º 19
0
        public void CreateHexagonTest_With1Points()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));

            shapeBUS.CreateHexagon();
        }
Ejemplo n.º 20
0
        public void SaveShapesTest1()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 5));
            shapeBUS.AddPoint(new Point(6, 5));
            shapeBUS.AddPoint(new Point(9, 5));
            shapeBUS.AddPoint(new Point(15, 5));

            shapeBUS.CreatePentagon();

            shapeBUS.SaveShapes("test.xaml");

            var fileText = File.ReadLines("test.xaml");

            Assert.IsTrue(fileText.ToString().Length > 1);
        }
Ejemplo n.º 21
0
        public void FillShapeTest1()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 5));
            shapeBUS.AddPoint(new Point(6, 5));
            shapeBUS.AddPoint(new Point(9, 5));
            shapeBUS.AddPoint(new Point(15, 5));

            shapeBUS.CreatePentagon();

            shapeBUS.ChooseShape("Pentagon_1");

            Color color = Color.FromRgb(0, 0, 0);

            shapeBUS.FillShape(color);
        }
Ejemplo n.º 22
0
 private void CanvasPaint_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (action != null && e.LeftButton == MouseButtonState.Pressed)
     {
         bus.AddPoint(Mouse.GetPosition(CanvasPaint));
         action();
     }
 }
Ejemplo n.º 23
0
        public void ChooseShapeTest()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 5));
            shapeBUS.AddPoint(new Point(6, 5));
            shapeBUS.AddPoint(new Point(9, 5));
            shapeBUS.AddPoint(new Point(15, 5));

            shapeBUS.CreatePentagon();

            shapeBUS.ChooseShape("Pentagon_1");

            int expected = 0;
            int actual   = shapeBUS.ChoosenShapeIndex;

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 24
0
        public void AddPointTest()
        {
            shapeBUS = new ShapeBUS();
            Point expectedPoint = new Point(5, 5);

            shapeBUS.AddPoint(expectedPoint);

            Point actualPoint = new Point((shapeBUS.Shapes[0] as MyPoint).X, (shapeBUS.Shapes[0] as MyPoint).Y);

            Assert.AreEqual(expectedPoint, actualPoint);
        }
Ejemplo n.º 25
0
        public void CreatePolygonTest2_With6Points()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));
            shapeBUS.AddPoint(new Point(5, 5));
            shapeBUS.AddPoint(new Point(6, 5));
            shapeBUS.AddPoint(new Point(9, 5));
            shapeBUS.AddPoint(new Point(15, 5));
            shapeBUS.AddPoint(new Point(12, 4));
            shapeBUS.AddPoint(new Point(15, 15));

            shapeBUS.CreatePolygon();
        }