private TypedTerminal <object> GetTerminalForNodeIfItAlreadyExists(IoNode ioNode) { if (!_ioNodeIdToTerminalViewModel.ContainsKey(ioNode.Model.Id)) { return(null); } return(_nodeSetup.CreateClientTerminal <object>(_ioNodeIdToTerminalViewModel[ioNode.Model.Id])); }
public void TestCreateClientTerminal_ViewModelNotOnNode_ThrowsException() { var nodeViewModelMoq = new Mock <Node>(); var terminalViewModelMoq = new Mock <Terminal>(new Mock <TerminalModel>().Object); terminalViewModelMoq.SetupGet(model => model.Model).Returns(new Mock <TerminalModel>().Object); nodeViewModelMoq.SetupGet(n => n.Terminals).Returns(new List <Terminal>()); var nodeSetup = new NodeSetup(nodeViewModelMoq.Object); nodeSetup.CreateClientTerminal <int>(terminalViewModelMoq.Object); }
public void TestCreateClientTerminal_ViewModelOnNode_ReturnsTerminal() { var nodeViewModelMoq = new Mock <Node>(); var terminalViewModelMoq = new Mock <Terminal>(new Mock <TerminalModel>().Object); terminalViewModelMoq.SetupGet(model => model.Model).Returns(new Mock <TerminalModel>().Object); nodeViewModelMoq.SetupGet(n => n.Terminals).Returns(new List <Terminal> { terminalViewModelMoq.Object }); var nodeSetup = new NodeSetup(nodeViewModelMoq.Object); Assert.IsNotNull(nodeSetup.CreateClientTerminal <int>(terminalViewModelMoq.Object)); }