示例#1
0
 public void TearDown()
 {
     _form.Dispose();
     _form = null;
 }
示例#2
0
 public void SetUp()
 {
     _mockFormInteractionHelper = new Mock<IFormInteractionHelper>();
     _form = new NodeForm(_mockFormInteractionHelper.Object);
 }
示例#3
0
        public void OnNodeFormOkClicked_ValuesVerfication()
        {
            //Arrange
            var nodeForm = new NodeForm
                {
                    HostName = "TestNode",
                    Description = "Test node description",
                    Address = new NetworkAddress {IpAddress = "172.0.0.1", SubnetMask = "255.255.255.0"},
                    Credentials = new NodeCredentials {UserName = "******", Password = "******"}
                };
            NetworkNode networkNode = null;
            _mockPresenter.Setup(p => p.CreateNetworkNode(It.IsAny<NetworkNode>()))
                          .Callback((NetworkNode n) => networkNode = n);

            //Act
            _form.OnNodeFormOkClicked(nodeForm, EventArgs.Empty);

            //Assert
            Assert.IsNotNull(networkNode);
            Assert.AreEqual(nodeForm.HostName, networkNode.HostName);
            Assert.AreEqual(nodeForm.Description, networkNode.Description);
            Assert.AreEqual(nodeForm.Address.IpAddress, networkNode.Address.IpAddress);
            Assert.AreEqual(nodeForm.Address.SubnetMask, networkNode.Address.SubnetMask);
            Assert.AreEqual(nodeForm.Credentials.UserName, networkNode.Credentials.UserName);
            Assert.AreEqual(nodeForm.Credentials.Password, networkNode.Credentials.Password);
        }
示例#4
0
        public void OnNodeFormOkClicked_UpdateNode()
        {
            //Arrange
            var nodeForm = new NodeForm();
            nodeForm.NodeId = Guid.NewGuid();

            //Act
            _form.OnNodeFormOkClicked(nodeForm, EventArgs.Empty);

            //Assert
            _mockPresenter.Verify(p => p.UpdateNetworkNode(It.IsAny<NetworkNode>()));
            _mockNodeList.Verify(l => l.UpdateNode(It.IsAny<NodeModel>()));
            _mockMapControl.Verify(m => m.UpdateNode(It.IsAny<NodeModel>()));
        }
示例#5
0
        public void OnNodeFormOkClicked_NodeCreated()
        {
            //Arrange
            var nodeForm = new NodeForm();

            //Act
            _form.OnNodeFormOkClicked(nodeForm, EventArgs.Empty);

            //Assert
            _mockPresenter.Verify(p => p.CreateNetworkNode(It.IsAny<NetworkNode>()));
            _mockNodeList.Verify(l => l.AddNode(It.IsAny<NodeModel>()));
        }
示例#6
0
 public void ShowNodeForm(NetworkNode node)
 {
     var nodeForm = new NodeForm();
     nodeForm.OkClicked += OnNodeFormOkClicked;
     nodeForm.NodeId = node.Id;
     nodeForm.HostName = node.HostName;
     nodeForm.Description = node.Description;
     nodeForm.Address = node.Address;
     nodeForm.Credentials = node.Credentials;
     _formInteractionHelper.ShowForm(nodeForm, this);
 }