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));
        }
예제 #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));
        }
예제 #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));
        }
예제 #4
0
 public void SetUp()
 {
     _classBuilderMock = new ClassBuilderMock();
     _walker = new DummyWalker(_classBuilderMock, new HamlHtmlOptions());
 }
예제 #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);
 }
예제 #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(""));
        }