public void ConstructorTest() { Mock <IGraphicalUserInterface> _IGraphicalUserInterface = new Mock <IGraphicalUserInterface>(); Mock <ISolutionConfigurationManagement> _solutionManagement = new Mock <ISolutionConfigurationManagement>(); _solutionManagement.SetupGet <string>(x => x.Name).Returns("Name"); ServerSelector _serverSelector = new ServerSelector(_IGraphicalUserInterface.Object, _solutionManagement.Object, "", ""); _solutionManagement.SetupGet <ServerSelector>(x => x.ServerSelector).Returns(_serverSelector); Mock <IMessageBoxHandling> _IMessageBoxHandlingMock = new Mock <IMessageBoxHandling>(); int _librariesCallCounter = 0; Assert.ThrowsException <ArgumentNullException>(() => new SolutionTreeNode(null, _solutionManagement.Object, (x, y) => { Assert.Fail(); }, z => _librariesCallCounter++)); Assert.ThrowsException <ArgumentNullException>(() => new SolutionTreeNode(_IMessageBoxHandlingMock.Object, null, (x, y) => { Assert.Fail(); }, z => _librariesCallCounter++)); SolutionTreeNode _instanceUnderTest = new SolutionTreeNode(_IMessageBoxHandlingMock.Object, _solutionManagement.Object, (x, y) => { Assert.Fail(); }, z => _librariesCallCounter++); //_IMessageBoxHandlingMock IMessageBoxHandling _assignedIMessageBoxHandling = null; _instanceUnderTest.GetMessageBoxHandling(x => _assignedIMessageBoxHandling = x); Assert.IsNotNull(_assignedIMessageBoxHandling); Assert.AreSame(_IMessageBoxHandlingMock.Object, _assignedIMessageBoxHandling); Assert.AreEqual <int>(0, _IMessageBoxHandlingMock.Invocations.Count); //State Assert.ThrowsException <NullReferenceException>(() => _instanceUnderTest.AvailiableNamespaces); Assert.AreEqual <int>(0, _instanceUnderTest.Count); Assert.IsNotNull(_instanceUnderTest.ErrorList); Assert.AreEqual <int>(0, _instanceUnderTest.ErrorList.Count); Assert.AreEqual <string>("", _instanceUnderTest.HelpTopicName); Assert.AreSame(_solutionManagement.Object, _instanceUnderTest.HomeDirectory); Assert.IsFalse(_instanceUnderTest.IsReadOnly); Assert.AreEqual <string>(_solutionManagement.Object.Name, _instanceUnderTest.Name); Assert.AreEqual <NodeClassesEnum>(NodeClassesEnum.None, _instanceUnderTest.NodeClass); Assert.AreEqual <NodeTypeEnum>(NodeTypeEnum.SolutionNode, _instanceUnderTest.NodeType); Assert.IsNull(_instanceUnderTest.Parent); Assert.IsNotNull(_instanceUnderTest.Server); Assert.AreSame(_serverSelector, _instanceUnderTest.Server); Assert.IsNotNull(_instanceUnderTest.SymbolicName); Assert.AreEqual <string>(_solutionManagement.Object.Name, _instanceUnderTest.Text); Assert.IsNull(_instanceUnderTest.ToolTipText); Assert.IsNotNull(_instanceUnderTest.Wrapper); Assert.IsInstanceOfType(_instanceUnderTest.Wrapper, typeof(Wrappers4ProperyGrid.UAModelDesignerSolutionWrapper)); Assert.IsNotNull(_instanceUnderTest.Wrapper4PropertyGrid); Assert.IsInstanceOfType(_instanceUnderTest.Wrapper4PropertyGrid, typeof(Wrappers4ProperyGrid.UAModelDesignerSolutionWrapper)); Libraries _libraries = null; _instanceUnderTest.GetLibraries(x => _libraries = x); Assert.IsNotNull(_libraries); Assert.AreEqual <int>(1, _libraries.Count); Assert.AreEqual <int>(1, _librariesCallCounter); }
public void ConstructorTest() { Mock <IMessageBoxHandling> _IMessageBoxHandlingMock = new Mock <IMessageBoxHandling>(); UAModelDesignerSolution _solution = UAModelDesignerSolution.CreateEmptyModel(); int _librariesCallCounter = 0; SolutionTreeNode _stn = new SolutionTreeNode(_IMessageBoxHandlingMock.Object, _solution, String.Empty, (x, y) => { Assert.Fail(); }, z => _librariesCallCounter++); //_IMessageBoxHandlingMock IMessageBoxHandling _assignedIMessageBoxHandling = null; _stn.GetMessageBoxHandling(x => _assignedIMessageBoxHandling = x); Assert.IsNotNull(_assignedIMessageBoxHandling); Assert.AreSame(_IMessageBoxHandlingMock.Object, _assignedIMessageBoxHandling); Assert.AreEqual <int>(0, _IMessageBoxHandlingMock.Invocations.Count); //State Assert.ThrowsException <NullReferenceException>(() => _stn.AvailiableNamespaces); Assert.AreEqual <int>(0, _stn.Count); Assert.IsNotNull(_stn.ErrorList); Assert.AreEqual <int>(0, _stn.ErrorList.Count); Assert.AreEqual <string>("", _stn.HelpTopicName); Assert.AreEqual <string>("", _stn.HomeDirectory); Assert.IsFalse(_stn.IsReadOnly); Assert.AreEqual <string>(_solution.Name, _stn.Name); Assert.AreEqual <NodeClassesEnum>(NodeClassesEnum.None, _stn.NodeClass); Assert.AreEqual <NodeTypeEnum>(NodeTypeEnum.SolutionNode, _stn.NodeType); Assert.IsNull(_stn.Parent); Assert.IsNotNull(_stn.Server); Assert.IsNotNull(_stn.SymbolicName); Assert.AreEqual <string>(_solution.Name, _stn.Text); Assert.IsNull(_stn.ToolTipText); Assert.IsNotNull(_stn.Wrapper); Assert.IsInstanceOfType(_stn.Wrapper, typeof(Wrappers4ProperyGrid.UAModelDesignerSolutionWrapper)); Assert.IsNotNull(_stn.Wrapper4PropertyGrid); Assert.IsInstanceOfType(_stn.Wrapper4PropertyGrid, typeof(Wrappers4ProperyGrid.UAModelDesignerSolutionWrapper)); Libraries _libraries = null; _stn.GetLibraries(x => _libraries = x); Assert.IsNotNull(_libraries); Assert.AreEqual <int>(1, _libraries.Count); Assert.AreEqual <int>(1, _librariesCallCounter); }
public IViewModel Create(SolutionTreeNode modelEntity) { throw new NotImplementedException(); }
public void ConstructorSolutionIsNullTest() { Mock <IMessageBoxHandling> _IMessageBoxHandlingMock = new Mock <IMessageBoxHandling>(); int _librariesCallCounter = 0; SolutionTreeNode _stn = new SolutionTreeNode(_IMessageBoxHandlingMock.Object, null, String.Empty, (x, y) => { Assert.Fail(); }, z => _librariesCallCounter++); }