public void ShouldCreateFalseNode()
        {
            // arrange
            var snf = new StalkNodeFactory(this.phabExternalMock.Object);
            var doc = new XmlDocument();

            doc.LoadXml("<false />");

            // act
            var result = snf.NewFromXmlFragment(doc.DocumentElement);

            // assert
            Assert.IsInstanceOf <FalseNode>(result);
        }
        public void ShouldCreateSummaryNode()
        {
            // arrange
            var snf = new StalkNodeFactory(this.phabExternalMock.Object);
            var doc = new XmlDocument();

            doc.LoadXml("<summary value=\"abc\" />");

            // act
            var result = snf.NewFromXmlFragment(doc.DocumentElement);

            // assert
            Assert.IsInstanceOf <SummaryStalkNode>(result);
            Assert.AreEqual("abc", ((SummaryStalkNode)result).GetMatchExpression());
        }
        public void ShouldCreateNotNode()
        {
            // arrange
            var snf = new StalkNodeFactory(this.phabExternalMock.Object);
            var doc = new XmlDocument();

            doc.LoadXml("<not><true /></not>");

            // act
            var result = snf.NewFromXmlFragment(doc.DocumentElement);

            // assert
            Assert.IsInstanceOf <NotNode>(result);

            var scln = (SingleChildLogicalNode)result;

            Assert.IsInstanceOf <TrueNode>(scln.ChildNode);
        }
        public void ShouldCreateXorNode()
        {
            // arrange
            var snf = new StalkNodeFactory(this.phabExternalMock.Object);
            var doc = new XmlDocument();

            doc.LoadXml("<xor><true /><false /></xor>");

            // act
            var result = snf.NewFromXmlFragment(doc.DocumentElement);

            // assert
            Assert.IsInstanceOf <XorNode>(result);

            var scln = (DoubleChildLogicalNode)result;

            Assert.IsInstanceOf <TrueNode>(scln.LeftChildNode);
            Assert.IsInstanceOf <FalseNode>(scln.RightChildNode);
        }
        public void ShouldCreateOrNode()
        {
            // arrange
            var snf = new StalkNodeFactory(this.phabExternalMock.Object);
            var doc = new XmlDocument();

            doc.LoadXml("<or><true /><false /></or>");

            // act
            var result = snf.NewFromXmlFragment(doc.DocumentElement);

            // assert
            Assert.IsInstanceOf <OrNode>(result);

            var mcln = (MultiChildLogicalNode)result;

            Assert.AreEqual(2, mcln.ChildNodes.Count);
            Assert.IsInstanceOf <TrueNode>(mcln.ChildNodes[0]);
            Assert.IsInstanceOf <FalseNode>(mcln.ChildNodes[1]);
        }
        public void ShouldCreateBasicXOfNode()
        {
            // arrange
            var snf = new StalkNodeFactory(this.phabExternalMock.Object);
            var doc = new XmlDocument();

            doc.LoadXml("<x-of><true /><false /></x-of>");

            // act
            var result = snf.NewFromXmlFragment(doc.DocumentElement);

            // assert
            Assert.IsInstanceOf <XOfStalkNode>(result);

            var mcln = (XOfStalkNode)result;

            Assert.IsNull(mcln.Minimum);
            Assert.IsNull(mcln.Maximum);
            Assert.AreEqual(2, mcln.ChildNodes.Count);
            Assert.IsInstanceOf <TrueNode>(mcln.ChildNodes[0]);
            Assert.IsInstanceOf <FalseNode>(mcln.ChildNodes[1]);
        }
        public void ShouldCreateInfixNumericNode2()
        {
            // arrange
            var snf = new StalkNodeFactory(this.phabExternalMock.Object);
            var doc = new XmlDocument();

            doc.LoadXml("<infixnumeric operator=\">=\"><number value=\"4\" /><pagesize /></infixnumeric>");

            // act
            var result = snf.NewFromXmlFragment(doc.DocumentElement);

            // assert
            Assert.IsInstanceOf <InfixNumericLogicalNode>(result);

            var inln = (InfixNumericLogicalNode)result;

            Assert.IsInstanceOf <StaticNumberNode>(inln.LeftChildNode);
            Assert.IsInstanceOf <PageSizeNumberNode>(inln.RightChildNode);

            var snn = (StaticNumberNode)inln.LeftChildNode;

            Assert.AreEqual(4, snn.Value);
        }