public void Walk_ChildNode_DoesNotThrowInvalidChildNodeException() { var node = new HamlNodeCode(new HamlLine("1+1", HamlRuleEnum.Code, "", -1)); node.AddChild(new HamlNodeTextContainer(0, "")); Assert.DoesNotThrow(() => _walker.Walk(node)); }
public void Walk_ValidNodeWithChildren_CallsRenderEndBlock() { string codeSnippet = "int c = 1"; var node = new HamlNodeCode(new HamlLine(codeSnippet, HamlRuleEnum.Code, "", -1)); node.AddChild(new HamlNodeTextContainer(-1, "")); _walker.Walk(node); _classBuilderMock.Verify(x => x.RenderEndBlock()); }
public void Walk_ConditionalWithChildNode_RendersChildNode() { const string dummyText = "Hello"; var node = new HamlNodeCode(new HamlLine("if (true)", HamlRuleEnum.Code, "", -1)); node.AddChild(new HamlNodeTextContainer(0, dummyText)); var classBuilder = new ClassBuilderMock(); var walker = new HamlNodeCodeWalker(classBuilder, new HamlHtmlOptions()); walker.Walk(node); Assert.That(classBuilder.Build(""), Is.EqualTo(dummyText)); }