예제 #1
0
        public HtmlTag BuildInPlaceHierarchyFor(ISpecNode node)
        {
            var active = BuildActiveTag(node);

            var builder = new ChildTagBuilder(this, active.Add("ul"));

            builder.AddChildren(node);

            var currentTag = active;

            while (node.Parent() != null)
            {
                var parentTag = BuildLeafTag(node.Parent());
                parentTag.Add("ul").Append(currentTag);

                currentTag = parentTag;

                node = node.Parent();
            }

            if (node is SpecificationGraph)
            {
                return(new HtmlTag("ul").Append(currentTag).Id("all-specs-node").AddClass("filetree"));
            }

            var topTag = TopTag(new HtmlTag("ul").Append(currentTag));

            return(topTag);
        }
예제 #2
0
        public HtmlTag BuildInPlaceHierarchyFor(ISpecNode node)
        {
            var active = BuildActiveTag(node);

            var builder = new ChildTagBuilder(this, active.Add("ul"));
            builder.AddChildren(node);

            var currentTag = active;
            while (node.Parent() != null)
            {
                var parentTag = BuildLeafTag(node.Parent());
                parentTag.Add("ul").Append(currentTag);

                currentTag = parentTag;

                node = node.Parent();
            }

            if (node is SpecificationGraph)
            {
                return new HtmlTag("ul").Append(currentTag).Id("all-specs-node").AddClass("filetree");
            }

            var topTag = TopTag(new HtmlTag("ul").Append(currentTag) );

            return topTag;
        }
예제 #3
0
 public HtmlTag BuildActiveTag(ISpecNode node)
 {
     return(new HtmlTag("li", x =>
     {
         string text = node.Path().Parts.LastOrDefault() ?? "All Specs";
         x.Add("span").AddClass("active").Text(text).AddClass(node.TreeClass);
     }));
 }
예제 #4
0
 public HtmlTag BuildActiveTag(ISpecNode node)
 {
     return new HtmlTag("li", x =>
     {
         string text = node.Path().Parts.LastOrDefault() ?? "All Specs";
         x.Add("span").AddClass("active").Text(text).AddClass(node.TreeClass);
     });
 }
예제 #5
0
        public HtmlTag BuildLeafTag(ISpecNode node)
        {
            return(new HtmlTag("li", tag =>
            {
                var url = _urls.UrlFor(node.Path());
                var link = new LinkTag(node.Path().Parts.Last(), url);

                tag.Add("span").AddClass("file").Append(link);
            }));
        }
예제 #6
0
        public HtmlTag BuildLeafTag(ISpecNode node)
        {
            return new HtmlTag("li", tag =>
            {
                var url = _urls.UrlFor(node.Path());
                var link = new LinkTag(node.Path().Parts.Last(), url);

                tag.Add("span").AddClass("file").Append(link);
            });
        }
        public void find_specs_by_path()
        {
            ISpecNode findSpecs = theGraph.FindSpecNode(new SpecPath("Pak2/folder1/folder2"));

            findSpecs.ShouldNotBeNull();


            findSpecs.AllSpecifications.Select(x => x.LibraryName).ShouldHaveTheSameElementsAs("spec6.js", "spec7.js", "spec8.js");
            theGraph.FindSpecNode(new SpecPath("Pak2/folder1")).AllSpecifications.Select(x => x.LibraryName).ShouldHaveTheSameElementsAs("spec6.js", "spec7.js", "spec8.js", "spec4.js", "spec5.js");
            theGraph.FindSpecNode(new SpecPath("Pak2")).AllSpecifications.Select(x => x.LibraryName).ShouldHaveTheSameElementsAs("spec6.js", "spec7.js", "spec8.js", "spec4.js", "spec5.js", "spec1.js", "spec2.js", "spec3.js");
        }
예제 #8
0
        private void writeNode(ISpecNode node)
        {
            var tag = _builder.BuildInPlaceHierarchyFor(node);

            _document.Add(tag);
            _document.Add("hr");

            _requirements.WriteAssetsInto(_document, node.AllSpecifications);

            var fileSystem = new FileSystem();
            node.AllSpecifications.SelectMany(x => x.HtmlFiles).Each(file =>
            {
                var html = fileSystem.ReadStringFromFile(file.FullPath);
                _document.Add("div").Text(html).Encoded(false);
            });
        }
예제 #9
0
        private void writeNode(ISpecNode node)
        {
            var tag = _builder.BuildInPlaceHierarchyFor(node);


            _document.Add(tag);
            _document.Add("hr");

            _requirements.WriteAssetsInto(_document, node.AllSpecifications);

            var fileSystem = new FileSystem();

            node.AllSpecifications.SelectMany(x => x.HtmlFiles).Each(file =>
            {
                var html = fileSystem.ReadStringFromFile(file.FullPath);
                _document.Add("div").Text(html).Encoded(false);
            });
        }
        public CompositeSpec(ISpecNode <T> specNode)
        {
            _specNode = specNode;
            var simplifiedSpecNode = new Lazy <ISpecNode <T> >(() =>
            {
                var deMorganSpecNodeVisitor = new DeMorganSpecNodeVisitor <T>();
                deMorganSpecNodeVisitor.Visit(specNode);
                return(deMorganSpecNodeVisitor.NewRoot);
            });

            _isSatisfiedBy = new Lazy <Func <T, bool> >(() =>
            {
                var isSatisfiedBySpecNodeVisitor = new IsSatisfiedBySpecNodeVisitor <T>();
                isSatisfiedBySpecNodeVisitor.Visit(simplifiedSpecNode.Value);
                return(isSatisfiedBySpecNodeVisitor.IsSatisfiedBy);
            });
            _isSatisfiedOn = new Lazy <string>(() =>
            {
                var isSatisfiedOnSpecNodeVisitor = new IsSatisfiedOnSpecNodeVisitor <T>();
                isSatisfiedOnSpecNodeVisitor.Visit(simplifiedSpecNode.Value);
                return(isSatisfiedOnSpecNodeVisitor.IsSatisfiedOn);
            });
        }
예제 #11
0
 public void AddChildren(ISpecNode node)
 {
     node.ImmediateChildren.Each(child => child.AcceptVisitor(this));
 }
예제 #12
0
 public OrSpecNode(ISpecNode <T> leftNode, ISpecNode <T> rightNode) => (LeftNode, RightNode) = (leftNode, rightNode);
 public void Visit(ISpecNode <T> specNode) => specNode.Accept(this);
예제 #14
0
 static string WrapOrBracket(ISpecNode <T> node, string isSatisfiedOn) =>
 node is OrSpecNode <T>?$"({isSatisfiedOn})" : isSatisfiedOn;
예제 #15
0
 public NotSpecNode(ISpecNode <T> nestedNode) => NestedNode = nestedNode;
예제 #16
0
 public void AddChildren(ISpecNode node)
 {
     node.ImmediateChildren.Each(child => child.AcceptVisitor(this));
 }