Example #1
0
        public void GetNextUnresolvedPartial_NoPartials_ReturnsNull()
        {
            var rootNode = new HamlNodeDummy();

            var result = rootNode.GetNextUnresolvedPartial();
            Assert.That(result, Is.Null);
        }
Example #2
0
 public void AddChild_ValidNode_AddsNodeToChildren()
 {
     var node = new HamlNodeDummy();
     var childNode = new HamlNodeDummy();
     node.Add(childNode);
     Assert.AreSame(childNode, node.Children[0]);
 }
Example #3
0
        public void GetNextUnresolvedPartial_NoPartials_ReturnsNull()
        {
            var rootNode = new HamlNodeDummy();

            var result = rootNode.GetNextUnresolvedPartial();

            Assert.That(result, Is.Null);
        }
Example #4
0
        public void Parent_RootNode_ReturnsNull()
        {
            var document = new HamlNodeDummy();

            var result = document.Parent;

            Assert.That(result, Is.Null);
        }
Example #5
0
        public void AddChild_ValidNode_AddsNodeToChildren()
        {
            var node      = new HamlNodeDummy();
            var childNode = new HamlNodeDummy();

            node.AddChild(childNode);
            Assert.AreSame(childNode, node.Children.First());
        }
Example #6
0
        public void Next_LastChild_ReturnsNull()
        {
            var document = new HamlNodeDummy();
            document.AddChild(new HamlNodeDummy());

            var result = document.Children.First().Next;
            Assert.That(result, Is.Null);
        }
Example #7
0
        public void GetNextUnresolvedPartial_Partials_ReturnsPartial()
        {
            var partial = new HamlNodePartial(new HamlLine("", HamlRuleEnum.Partial, new HamlSourceFileMetrics(-1, 0, 0, 0), ""));
            var rootNode = new HamlNodeDummy();
            rootNode.AddChild(partial);

            var result = rootNode.GetNextUnresolvedPartial();
            Assert.That(result, Is.EqualTo(partial));
        }
Example #8
0
        public void Next_LastChild_ReturnsNull()
        {
            var document = new HamlNodeDummy();

            document.AddChild(new HamlNodeDummy());

            var result = document.Children.First().Next;

            Assert.That(result, Is.Null);
        }
Example #9
0
        public void Parent_ValidChildNode_ReturnsParent()
        {
            var document = new HamlNodeDummy();

            document.AddChild(new HamlNodeDummy());

            var result = document.Children.First().Parent;

            Assert.That(result, Is.SameAs(document));
        }
Example #10
0
        public void Next_ValidNextSibling_ReturnsNextSibling()
        {
            var document = new HamlNodeDummy();

            document.AddChild(new HamlNodeDummy());
            document.AddChild(new HamlNodeDummy());

            var result = document.Children.First().Next;

            Assert.That(result, Is.SameAs(document.Children.ToList()[1]));
        }
Example #11
0
        public void Previous_ValidPreviousSibling_ReturnsPreviousSibling()
        {
            var document = new HamlNodeDummy();

            document.AddChild(new HamlNodeDummy());
            document.AddChild(new HamlNodeDummy());

            var result = new List <HamlNode>(document.Children)[1].Previous;

            Assert.That(result, Is.SameAs(document.Children.First()));
        }
Example #12
0
        public void GetNextUnresolvedPartial_Partials_ReturnsPartial()
        {
            var partial  = new HamlNodePartial(new HamlLine("", HamlRuleEnum.Partial, "", -1));
            var rootNode = new HamlNodeDummy();

            rootNode.AddChild(partial);

            var result = rootNode.GetNextUnresolvedPartial();

            Assert.That(result, Is.EqualTo(partial));
        }
Example #13
0
        public void Next_ValidChildren_ReturnsNull()
        {
            var document = new HamlNodeDummy();

            document.AddChild(new HamlNodeDummy());
            document.AddChild(new HamlNodeDummy());

            var result = document.Next;

            Assert.That(result, Is.Null);
        }
Example #14
0
        public void GetNextUnresolvedPartial_PartialIsAGrandchildNode_ReturnsPartial()
        {
            var textContainerNode = new HamlNodeTextContainer(0, "Test content");
            var partial = new HamlNodePartial(new HamlLine("", HamlRuleEnum.Partial, "", -1));
            textContainerNode.AddChild(partial);

            var rootNode = new HamlNodeDummy();
            rootNode.AddChild(textContainerNode);

            var result = rootNode.GetNextUnresolvedPartial();
            Assert.That(result, Is.EqualTo(partial));
        }
Example #15
0
        public void GetNextUnresolvedPartial_OneResolvedAndOneUnresolvedPartial_ReturnsCorrectPartial()
        {
            var resolvedPartial = new HamlNodePartial(new HamlLine("", HamlRuleEnum.Partial, new HamlSourceFileMetrics(-1, 0, 0, 0), indent: ""));
            resolvedPartial.SetDocument(HamlDocumentBuilder.Create());

            var unresolvedPartial = new HamlNodePartial(new HamlLine("", HamlRuleEnum.Partial, new HamlSourceFileMetrics(-1, 0, 0, 0), indent: ""));

            var rootNode = new HamlNodeDummy();
            rootNode.AddChild(resolvedPartial);
            rootNode.AddChild(unresolvedPartial);

            var result = rootNode.GetNextUnresolvedPartial();
            Assert.That(result, Is.EqualTo(unresolvedPartial));
        }
Example #16
0
        public void GetNextUnresolvedPartial_PartialIsAGrandchildNode_ReturnsPartial()
        {
            var textContainerNode = new HamlNodeTextContainer(0, "Test content");
            var partial           = new HamlNodePartial(new HamlLine("", HamlRuleEnum.Partial, "", -1));

            textContainerNode.AddChild(partial);

            var rootNode = new HamlNodeDummy();

            rootNode.AddChild(textContainerNode);

            var result = rootNode.GetNextUnresolvedPartial();

            Assert.That(result, Is.EqualTo(partial));
        }
Example #17
0
        public void GetNextUnresolvedPartial_OneResolvedAndOneUnresolvedPartial_ReturnsCorrectPartial()
        {
            var resolvedPartial = new HamlNodePartial(new HamlLine("", HamlRuleEnum.Partial, "", -1));

            resolvedPartial.SetDocument(HamlDocumentBuilder.Create());

            var unresolvedPartial = new HamlNodePartial(new HamlLine("", HamlRuleEnum.Partial, "", -1));

            var rootNode = new HamlNodeDummy();

            rootNode.AddChild(resolvedPartial);
            rootNode.AddChild(unresolvedPartial);

            var result = rootNode.GetNextUnresolvedPartial();

            Assert.That(result, Is.EqualTo(unresolvedPartial));
        }
Example #18
0
        public void Next_ValidNextSibling_ReturnsNextSibling()
        {
            var document = new HamlNodeDummy();
            document.AddChild(new HamlNodeDummy());
            document.AddChild(new HamlNodeDummy());

            var result = document.Children.First().Next;
            Assert.That(result, Is.SameAs(document.Children.ToList()[1]));
        }
Example #19
0
        public void Next_ValidChildren_ReturnsNull()
        {
            var document = new HamlNodeDummy();
            document.AddChild(new HamlNodeDummy());
            document.AddChild(new HamlNodeDummy());

            var result = document.Next;
            Assert.That(result, Is.Null);
        }
Example #20
0
        public void Parent_RootNode_ReturnsNull()
        {
            var document = new HamlNodeDummy();

            var result = document.Parent;
            Assert.That(result, Is.Null);
        }
Example #21
0
        public void Previous_ValidPreviousSibling_ReturnsPreviousSibling()
        {
            var document = new HamlNodeDummy();
            document.AddChild(new HamlNodeDummy());
            document.AddChild(new HamlNodeDummy());

            var result = new List<HamlNode>(document.Children)[1].Previous;
            Assert.That(result, Is.SameAs(document.Children.First()));
        }
Example #22
0
        public void Parent_ValidChildNode_ReturnsParent()
        {
            var document = new HamlNodeDummy();
            document.AddChild(new HamlNodeDummy());

            var result = document.Children.First().Parent;
            Assert.That(result, Is.SameAs(document));
        }