public void Walk_VaryingAttributeCollections_WritesCorrectAttributes(string hamlLine, string expectedTag)
        {
            var node = new HamlNodeHtmlAttributeCollection(0, hamlLine);

            var builder = new ClassBuilderMock();
            new HamlNodeHtmlAttributeCollectionWalker(builder, new HamlHtmlOptions())
                .Walk(node);

            Assert.That(builder.Build(""), Is.EqualTo(expectedTag));
        }
Exemplo n.º 2
0
        public void Walk_ConditionalWithChildNode_RendersChildNode()
        {
            const string dummyText = "Hello";
            var node = new HamlNodeCode(new HamlLine("if (true)", HamlRuleEnum.Code, indent: ""));
            node.AddChild(new HamlNodeTextContainer(new HamlSourceFileMetrics(0, 0, 0, 0), dummyText));
            var classBuilder = new ClassBuilderMock();

            var walker = new HamlNodeCodeWalker(classBuilder, new HamlHtmlOptions());
            walker.Walk(node);

            Assert.That(classBuilder.Build(""), Is.EqualTo(dummyText));
        }
Exemplo n.º 3
0
        public void Walk_TextNode_AppendsCorrectTag()
        {
            // Arrange
            var content = new HamlLine("Simple content", HamlRuleEnum.PlainText, indent: "");
            var document = HamlDocumentBuilder.Create("",
                new HamlNodeTextContainer(content));
            Type baseType = typeof(Template);

            // Act
            var builder = new ClassBuilderMock();
            new HamlDocumentWalker(builder).Walk(document, "", baseType, new List<string>());

            // Assert
            Assert.That(builder.Build(""), Is.EqualTo(content.Content));
        }
Exemplo n.º 4
0
 public void SetUp()
 {
     _classBuilderMock = new ClassBuilderMock();
     _walker = new DummyWalker(_classBuilderMock, new HamlHtmlOptions());
 }
Exemplo n.º 5
0
 public void SetUp()
 {
     _classBuilderMock = new ClassBuilderMock();
     _hamlOptions = new HamlHtmlOptions();
     _tagWalker = new HamlNodeTagWalker(_classBuilderMock, _hamlOptions);
 }
 public void SetUp()
 {
     _mockClassBuilder = new ClassBuilderMock();
     _walker = new HamlNodeTextContainerWalker(_mockClassBuilder, new HamlHtmlOptions());
 }
 public void SetUp()
 {
     _classBuilderMock = new ClassBuilderMock();
     _hamlOptions = new HamlHtmlOptions();
     _walker = new HamlNodeHtmlCommentWalker(_classBuilderMock, _hamlOptions);
 }
Exemplo n.º 8
0
        public void Walk_ValidNode_DoesNotGenerateContent()
        {
            var node = new HamlNodeCode(new HamlLine("1+1", HamlRuleEnum.Code, indent: ""));
            var classBuilder = new ClassBuilderMock();
            var walker = new HamlNodeCodeWalker(classBuilder, new HamlHtmlOptions());
            walker.Walk(node);

            Assert.That(classBuilder.Build(""), Is.EqualTo(""));
        }