AppendText() public method

Appends some text to the Element
public AppendText ( string text ) : Element
text string
return Element
        private void AddFooterToDocument(Element rootElement, Resource resource, long timeTaken)
        {
            Element body = rootElement.GetFirstChildElement("body");

            if (body != null)
            {

                Element footer = new Element("div");
                footer.AddStyleClass("footer");
                footer.AppendText("Results generated by ");

                Element link = new Element("a");
                link.AddAttribute("href", CONCORDION_WEBSITE_URL);
                footer.AppendChild(link);

                Element img = new Element("img");
                img.AddAttribute("src", resource.GetRelativePath(TARGET_LOGO_RESOURCE));
                img.AddAttribute("alt", "Concordion");
                img.AddAttribute("border", "0");
                link.AppendChild(img);

                Element dateDiv = new Element("div");
                dateDiv.AddStyleClass("testTime");
                dateDiv.AppendText("in " + (timeTaken + 1) + " ms ");
                dateDiv.AppendText(DateTime.Now.ToString());
                footer.AppendChild(dateDiv);

                body.AppendChild(footer);
            }
        }
        public void FailureReportedEventHandler(object sender, global::Concordion.Internal.Commands.FailureReportedEventArgs e)
        {
            Element element = e.Element;
            element.AddStyleClass("failure");

            Element spanExpected = new Element("del");
            spanExpected.AddStyleClass("expected");
            element.MoveChildrenTo(spanExpected);
            element.AppendChild(spanExpected);
            spanExpected.AppendNonBreakingSpaceIfBlank();

            Element spanActual = new Element("ins");
            spanActual.AddStyleClass("actual");
            if (e.Actual != null)
            {
                spanActual.AppendText(e.Actual.ToString());
            }
            else
            {
                spanActual.AppendText("(null)");
            }
            spanActual.AppendNonBreakingSpaceIfBlank();

            element.AppendText("\n");
            element.AppendChild(spanActual);
        }
Esempio n. 3
0
        public void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
        {
            Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside an 'echo' is not supported");

            Object result = evaluator.Evaluate(commandCall.Expression);

            Element element = commandCall.Element;
            if (result != null)
            {
                element.AppendText(result.ToString());
            }
            else
            {
                Element child = new Element("em");
                child.AppendText("null");
                element.AppendChild(child);
            }
        }
        public void FailureReported(AssertFailureEvent failureEvent)
        {
            var element = failureEvent.Element;
            element.AddStyleClass("failure");

            var spanExpected = new Element("del");
            spanExpected.AddStyleClass("expected");
            element.MoveChildrenTo(spanExpected);
            element.AppendChild(spanExpected);
            spanExpected.AppendNonBreakingSpaceIfBlank();

            var spanActual = new Element("ins");
            spanActual.AddStyleClass("actual");
            spanActual.AppendText(failureEvent.Actual != null ? failureEvent.Actual.ToString() : "(null)");
            spanActual.AppendNonBreakingSpaceIfBlank();

            element.AppendText("\n");
            element.AppendChild(spanActual);
        }
        private void AddFooterToDocument(Element rootElement, Resource resource, long timeTaken)
        {
            Element body = rootElement.GetFirstChildElement("body");

            if (body != null)
            {

                Element footer = new Element("div");
                footer.AddStyleClass("footer");
                footer.AppendText("Powered by ");

                Element link = new Element("a");
                link.AddAttribute("href", CONCORDION_WEBSITE_URL);
                footer.AppendChild(link);

                Element img = new Element("img");
                img.AddAttribute("src", resource.GetRelativePath(TARGET_LOGO_RESOURCE));
                img.AddAttribute("alt", "Concordion");
                img.AddAttribute("border", "0");
                link.AppendChild(img);

                body.AppendChild(footer);
            }
        }
        private void EnsureDocumentHasTogglingScript(Element element)
        {
            Element rootElement = element.GetRootElement();

            if (!RootElementsWithScript.Contains(rootElement))
            {
                RootElementsWithScript.Add(rootElement);
                Element head = rootElement.GetFirstDescendantNamed("head");
                if (head == null)
                {
                    Console.WriteLine(rootElement.ToXml());
                }
                Check.NotNull(head, "Document <head> section is missing");
                Element script = new Element("script").AddAttribute("type", "text/javascript");
                head.PrependChild(script);
                script.AppendText(HtmlFramework.TOGGLING_SCRIPT_RESOURCE);
            }
        }
        private Element CreateBreadcrumbElement(Resource documentResource, Resource indexPageResource)
        {
            XDocument document;

            using (var inputStream = this.Source.CreateReader(indexPageResource))
            {
                document = XDocument.Load(inputStream);
            }

            var breadcrumbWording = this.GetBreadcrumbWording(new Element(document.Root), indexPageResource);
            var a = new Element("a");
            a.AddAttribute("href", documentResource.GetRelativePath(indexPageResource));
            a.AppendText(breadcrumbWording);
            return a;
        }