Beispiel #1
0
        public void ConstructorWithMapNodeModel()
        {
            //Arrange
            var model = new MapNodeModel
                {
                    NodeId = Guid.NewGuid(),
                    Name = "Some Node",
                    Position = new Point(100, 100)
                };

            //Act
            _nodeControl = new NodeControl(model);

            //Assert
            Assert.AreEqual(model.NodeId, _nodeControl.NodeId);
            Assert.AreEqual(model.Name, _nodeControl.HostName);
            Assert.AreEqual(model.Position, _nodeControl.Location);
        }
Beispiel #2
0
        public void StopNodeConnector()
        {
            //Arrange
            var nodeControl = new NodeControl();
            nodeControl.ConnectingNodes = true;
            _control.Controls.Add(nodeControl);
            _control.Controls.Add(new TextBox());
            var connector = new Connector(_control);
            _CurrentContectorField.SetValue(_control, connector);

            //Act
            _control.StopNodeConnector();

            //Assert
            Assert.IsFalse(nodeControl.ConnectingNodes);
            Assert.IsNull(_CurrentContectorField.GetValue(_control));
            Assert.AreEqual(Cursors.Default, _control.Cursor);
        }
Beispiel #3
0
        public void StartNodeConnector()
        {
            //Arrange
            var nodeControl = new NodeControl();
            _control.Controls.Add(nodeControl);

            //Act
            _control.StartNodeConnector();

            //Assert
            Assert.AreEqual(Cursors.Cross, _control.Cursor);
            Assert.IsTrue(nodeControl.ConnectingNodes);
        }
Beispiel #4
0
 public void TearDown()
 {
     _nodeControl.Dispose();
     _nodeControl = null;
 }
Beispiel #5
0
 public void SetUp()
 {
     _mockFormInteractionHelper = new Mock<IFormInteractionHelper>();
     _mockControlPaintHelper = new Mock<IControlPaintHelper>();
     _nodeControl = new NodeControl(_mockFormInteractionHelper.Object, _mockControlPaintHelper.Object);
 }
Beispiel #6
0
        public void UpdateNode_NodeControlNotFound()
        {
            //Arrange
            var node = new NodeModel {NodeId = Guid.NewGuid(), Name = "Node Name"};
            var nodeControl = new NodeControl {Name = Guid.NewGuid().ToString()};
            _control.Controls.Add(nodeControl);

            //Act
            _control.UpdateNode(node);

            //Assert
            Assert.AreNotEqual(node.Name, nodeControl.HostName);
        }
Beispiel #7
0
        public void UpdateNode()
        {
            //Arrange
            var node = new NodeModel { NodeId = Guid.NewGuid(), Name = "New Name" };
            var nodeControl = new NodeControl { Name = node.NodeId.ToString(), HostName = "Old Name"};
            _control.Controls.Add(nodeControl);

            //Act
            _control.UpdateNode(node);

            //Assert
            Assert.AreEqual(node.Name, nodeControl.HostName);
        }
Beispiel #8
0
 //TODO: create unit tests
 public NodeControl CreateNodeControl(MapNodeModel node)
 {
     var nodeControl = new NodeControl(node);
     nodeControl.Moved += OnNodeControlMoved;
     nodeControl.Edit += OnNodeControlEdit;
     nodeControl.Remove += OnNodeControlRemove;
     nodeControl.Connect += OnNodeConnect;
     nodeControl.GenearateConfig += OnGenerateNodeConfig;
     return nodeControl;
 }