public void NodeParserErrorsWithInvalidPath() { // arrange: ILog logger = MockRepository.GenerateMock<ILog>(); NodeParser np = new NodeParser(logger); logger.Expect(l => l.ErrorFormat(Arg<string>.Is.Equal(np.messageInvalidPath), Arg<object>.Is.Equal("invalid"))); //act: var result = np.ParseNodes(new string[1] { "invalid" }); //assert: logger.VerifyAllExpectations(); }
public void NodeParserFailsWithEmptyPath() { // arrange: ILog logger = MockRepository.GenerateMock<ILog>(); NodeParser np = new NodeParser(logger); logger.Expect(l => l.Warn(Arg<string>.Is.Equal(np.messageNoArgs))); //act: var result = np.ParseNodes(new string[0]); //assert: logger.VerifyAllExpectations(); }
public void NodeParserWorks() { // arrange: ILog logger = MockRepository.GenerateMock<ILog>(); NodeParser np = new NodeParser(logger); //act: var result = np.ParseNodes(new string[1] { "TestInput" }); //assert: Assert.AreEqual(2, result.Count); var microsoftNode = result.First(r => r.label == "Microsoft"); var ibmNode = result.First(r => r.label == "IBM"); Assert.IsNotNull(ibmNode); Assert.IsNotNull(microsoftNode); Assert.AreEqual(0, ibmNode.adjacentNodes.Count); Assert.AreEqual(1, microsoftNode.adjacentNodes.Count); }
public void ParseNodes_WhenParsingXDocument_ShouldGetNodes() { var xDocument = new XDocument(new XElement("node")); var nodes = _nodeParser.ParseNodes(xDocument); Assert.AreEqual(1, nodes.Count); }