Пример #1
0
        public void CreatePentagonTest_With1Points()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));

            shapeBUS.CreatePentagon();
        }
Пример #2
0
        public void NewShapeForCancasTest4()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));

            CanvasBUS.NewShapeForCancas(shapeBUS.Shapes[0] as PointShape);
        }
Пример #3
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);
        }
Пример #4
0
        public void CreateEllipseTest_With1Points()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));

            shapeBUS.CreateEllipse();
        }
Пример #5
0
        public void CreatePolylineTest_With1Points()
        {
            shapeBUS = new ShapeBUS();
            shapeBUS.AddPoint(new Point(0, 0));

            shapeBUS.CreatePolyline();
        }
Пример #6
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");
        }
Пример #7
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();
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
0
        public void CreatePolylineTest2_With2Points()
        {
            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();
        }
Пример #11
0
        public void CreateHexagonTest_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, 5));

            shapeBUS.CreateHexagon();
        }
Пример #12
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);
        }
Пример #13
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);
        }
Пример #14
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();
        }
Пример #15
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");
        }
Пример #16
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);
        }
Пример #17
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));
        }
Пример #18
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);
        }
Пример #19
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);
        }
Пример #20
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);
        }
Пример #21
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));
        }
Пример #22
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);
        }
Пример #23
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);
        }
Пример #24
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);
        }
Пример #25
0
        public MainWindow()
        {
            InitializeComponent();
            bus = new ShapeBUS();

            bus.Shapes.CollectionChanged += Shapes_CollectionChanged;
            ShapesListMenu.ItemsSource    = bus.Shapes;
            ContextMenuItems.ItemsSource  = bus.Shapes;

            ShapesListMenu.IsEnabled = false;

            CommandBindings.Add(new CommandBinding(ApplicationCommands.New, NewMenuItem_Click, (sender, e) => { e.CanExecute = true; }));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Open, OpenMenuItem_Click, (sender, e) => { e.CanExecute = true; }));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Save, SaveMenuItem_Click, (sender, e) => { e.CanExecute = true; }));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.SaveAs, SaveAsMenuItem_Click, (sender, e) => { e.CanExecute = true; }));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, ExitMenuItem_Click, (sender, e) => { e.CanExecute = true; }));
        }
Пример #26
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);
        }