public void OnCondeControlMoved()
        {
            //Arrange
            var eventArgs = new MapNodeEventArgs();
            var handlerCalled = false;
            _control.NodeMoved += (sender, args) => handlerCalled = true;

            //Act
            _control.OnNodeControlMoved(null, eventArgs);

            //Assert
            Assert.IsTrue(handlerCalled);
        }
        public void OnNodeAddedToMap()
        {
            //Arrange
            var randomizer = new Randomizer();
            var x = randomizer.Next(-100, 100);
            var y = randomizer.Next(-100, 100);
            var point = new Point(x, y);
            var node = new NodeModel { NodeId = Guid.NewGuid(), Name = "SomeNode" };
            var args = new MapNodeEventArgs {NodeId = node.NodeId, Position = point };

            //Act
            _form.OnNodeAddedToMap(null, args);

            //Assert
            _mockNodeList.Verify(l => l.RemoveNode(node.NodeId));
            _mockPresenter.Verify(p => p.NodeAddedToMap(node.NodeId, x, y));
        }
        public void OnNodeMove()
        {
            //Arrange
            var randomizer = new Randomizer();
            var x = randomizer.Next(-100, 100);
            var y = randomizer.Next(-100, 100);
            var point = new Point(x, y);
            var args = new MapNodeEventArgs {NodeId = Guid.NewGuid(), Position = point};

            //Act
            _form.OnNodeMoved(null,args);

            //Assert
            _mockPresenter.Verify(p => p.NodeMovedOnMap(args.NodeId, x, y));
        }
Exemple #4
0
        public void OnMouseUp(object sender, MouseEventArgs e)
        {
            if (LeftMouseDown && e.Button == MouseButtons.Left)
            {
                if (IsMoving && Moved != null)
                {
                    var scrollOffset = ((MapControl)Parent).AutoScrollPosition;
                    var position = new Point(Location.X - scrollOffset.X, Location.Y - scrollOffset.Y);
                    var args = new MapNodeEventArgs { NodeId = NodeId, Position = position };
                    Moved(this, args);
                }

                Cursor = defaultCursor;
                LeftMouseDown = false;
                IsMoving = false;
                x = 0;
                y = 0;
            }
        }
Exemple #5
0
 public void OnNodeControlMoved(object sender, MapNodeEventArgs mapNodeEventArgs)
 {
     if (NodeMoved != null)
         NodeMoved(this, mapNodeEventArgs);
 }
Exemple #6
0
        public void OnDragDrop(object sender, DragEventArgs drgevent)
        {
            var node = drgevent.Data.GetData(typeof (NodeModel)) as NodeModel;

            if (node == null)
                return;

            var mapNodel = new MapNodeModel
                {
                    NodeId = node.NodeId,
                    Name = node.Name,
                    Position = _formInteractionHelper.PointToClient(this, drgevent.X, drgevent.Y)
                };

            var nodeControl = CreateNodeControl(mapNodel);
            Controls.Add(nodeControl);
            nodeControl.BringToFront();

            if (NodeAddedToMap != null)
            {
                var args = new MapNodeEventArgs { NodeId = node.NodeId, Position = mapNodel.Position };
                NodeAddedToMap(this, args);
            }
        }
Exemple #7
0
 public void OnNodeMoved(object sender, MapNodeEventArgs e)
 {
     _presenter.NodeMovedOnMap(e.NodeId, e.Position.X, e.Position.Y);
 }
Exemple #8
0
 public void OnNodeAddedToMap(object sender, MapNodeEventArgs e)
 {
     NodeListControl.RemoveNode(e.NodeId);
     _presenter.NodeAddedToMap(e.NodeId, e.Position.X, e.Position.Y);
 }