Ejemplo n.º 1
0
        public void Walk_ChildNode_ThrowsInvalidChildNodeException()
        {
            string codeSnippet = "1+1";
            var node = new HamlNodeEval(new HamlLine(codeSnippet, HamlRuleEnum.PlainText, "", -1));
            node.AddChild(new HamlNodeTextContainer(0, ""));

            Assert.Throws<HamlInvalidChildNodeException>(() => _walker.Walk(node));
        }
Ejemplo n.º 2
0
        public void Walk_ValidNode_CallsAppendCodeToStringMethod()
        {
            string codeSnippet = "1+1";
            var node = new HamlNodeEval(new HamlLine(codeSnippet, HamlRuleEnum.PlainText, "", -1));

            _walker.Walk(node);

            _classBuilderMock.Verify(x => x.AppendCodeToString(codeSnippet));
        }
Ejemplo n.º 3
0
        private HamlNodeHtmlAttribute(int sourceFileLineNo, string nameValuePair)
            : base(sourceFileLineNo, nameValuePair)
        {
            int index = 0;

            _name = ParseName(ref index, nameValuePair, sourceFileLineNo);
            var value = ParseValue(index, nameValuePair);

            if (value.StartsWith("\"") || value.StartsWith("\'"))
            {
                Child = new HamlNodeTextContainer(sourceFileLineNo, value).Children[0];
            }
            else
            {
                Child = new HamlNodeEval(sourceFileLineNo, value);
            }
        }