public void ShouldSerialiseFalseCorrectly()
        {
            // arrange
            var node = new FalseNode();
            var doc  = new XmlDocument();

            var snf = new StalkNodeFactory(this.phabExternalMock.Object);

            // act
            var result = snf.ToXml(doc, node);

            // assert
            Assert.AreEqual("<false />", result.OuterXml);
        }
        public void ShouldSerialiseUserGroupCorrectly()
        {
            // arrange
            var node = new UserGroupStalkNode();

            node.SetMatchExpression("abc");

            var doc = new XmlDocument();

            var snf = new StalkNodeFactory(this.phabExternalMock.Object);

            // act
            var result = snf.ToXml(doc, node);

            // assert
            Assert.AreEqual("<usergroup value=\"abc\" />", result.OuterXml);
        }
        public void ShouldSerialiseNotCorrectly()
        {
            // arrange
            var node = new NotNode
            {
                ChildNode = new TrueNode()
            };

            var doc = new XmlDocument();

            var snf = new StalkNodeFactory(this.phabExternalMock.Object);

            // act
            var result = snf.ToXml(doc, node);

            // assert
            Assert.AreEqual("<not><true /></not>", result.OuterXml);
        }
        public void ShouldSerialiseInsensitivePageCorrectly()
        {
            // arrange
            var node = new PageStalkNode();

            node.SetMatchExpression("abc");
            node.CaseInsensitive = true;

            var doc = new XmlDocument();

            var snf = new StalkNodeFactory(this.phabExternalMock.Object);

            // act
            var result = snf.ToXml(doc, node);

            // assert
            Assert.AreEqual("<page value=\"abc\" caseinsensitive=\"true\" />", result.OuterXml);
        }
        public void ShouldSerialiseXorCorrectly()
        {
            // arrange
            var node = new XorNode
            {
                LeftChildNode  = new TrueNode(),
                RightChildNode = new FalseNode()
            };

            var doc = new XmlDocument();

            var snf = new StalkNodeFactory(this.phabExternalMock.Object);

            // act
            var result = snf.ToXml(doc, node);

            // assert
            Assert.AreEqual("<xor><true /><false /></xor>", result.OuterXml);
        }
        public void ShouldSerialiseInfixCorrectly2()
        {
            // arrange
            var node = new InfixNumericLogicalNode
            {
                Operator      = "==",
                LeftChildNode = new StaticNumberNode {
                    Value = 4
                },
                RightChildNode = new PageSizeNumberNode()
            };

            var doc = new XmlDocument();

            var snf = new StalkNodeFactory(this.phabExternalMock.Object);

            // act
            var result = snf.ToXml(doc, node);

            // assert
            Assert.AreEqual("<infixnumeric operator=\"==\"><number value=\"4\" /><pagesize /></infixnumeric>", result.OuterXml);
        }
        public void ShouldSerialiseBasicXOfCorrectly()
        {
            // arrange
            var node = new XOfStalkNode
            {
                ChildNodes = new List <IStalkNode>
                {
                    new TrueNode(),
                    new FalseNode()
                }
            };

            var doc = new XmlDocument();

            var snf = new StalkNodeFactory(this.phabExternalMock.Object);

            // act
            var result = snf.ToXml(doc, node);

            // assert
            Assert.AreEqual("<x-of><true /><false /></x-of>", result.OuterXml);
        }