Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public void ParseNodes_WhenParsingXDocument_ShouldGetNodes()
        {
            var xDocument = new XDocument(new XElement("node"));
            var nodes     = _nodeParser.ParseNodes(xDocument);

            Assert.AreEqual(1, nodes.Count);
        }