Beispiel #1
0
        public HtmlDocument Index()
        {
            var doc = new HtmlDocument {Title = "Asp.Net HttpContext"};

            doc.Add("h1")
                .Text(
                    "The list below is the result of requesting an HttpContext lifecycled object from the container 5 times.  You should see the same Guid all 5 times.  If you refresh, you should see a different Guid");


            doc.Push("ul");
            doc.Add("li").Text(_container.GetInstance<HttpContextTracked>().Name.ToString());
            doc.Add("li").Text(_container.GetInstance<HttpContextTracked>().Name.ToString());
            doc.Add("li").Text(_container.GetInstance<HttpContextTracked>().Name.ToString());
            doc.Add("li").Text(_container.GetInstance<HttpContextTracked>().Name.ToString());
            doc.Add("li").Text(_container.GetInstance<HttpContextTracked>().Name.ToString());


            doc.Pop();


            doc.Add("hr");
            doc.Add("p").Text("The following is a list of previously disposed HttpContextTraced objects");
            doc.Push("ul");

            DisposeTracker.DisposedThings.Each(x => doc.Add("li").Text(x.Name.ToString()));


            return doc;
        }
        public PreviewWriter(HtmlDocument document, ITestContext context)
        {
            _document = document;
            _context = context;

            _document.AddStyle(HtmlClasses.CSS());

            _document.Push("div").AddClass("main");
        }
        public HtmlDocument ShowView(ViewInput input)
        {
            var document = new HtmlDocument();

            document.Title = input.Name;

            document.Push("p");
            document.Add("span").Text("The input was '");
            document.Add("span").Id("name").Text(input.Name);
            document.Add("span").Text("'");

            return document;
        }
        public HtmlDocument get_failure_page(SamlResponse response)
        {
            var document = new HtmlDocument();
            document.Title = "Failure Page";

            document.Add("h1").Text("This is the failure page");

            document.Push("ul");

            response.Errors.Each(x => document.Add("li").Text(x.Message));

            return document;
        }
        public DeploymentReport(string title)
        {
            _document = new HtmlDocument
                        {
                            Title = title
                        };

            _document.AddStyle(getCss());
            _document.AddJavaScript(getJs("jquery-1.6.1.min.js"));
            _document.AddJavaScript(getJs("sneaky.js"));
            _document.AddStyle(".header {text-indent:20px;background:" + getPngAsCssData("bullet_arrow_right.png") + " 5px 13px no-repeat; cursor:pointer;}");
            _document.AddStyle(".expanded {background:" + getPngAsCssData("bullet_arrow_down.png") + " 5px 13px no-repeat}");

            _document.Push("div").AddClass("main");

            _document.Add("h1").Text(title);
        }
        public HtmlDocument get__todo()
        {
            var document = new HtmlDocument
            {
                Title = "TODO's"
            };

            document.Head.Add("link").Attr("rel", "stylesheet").Attr("type", "text/css")
                .Attr("href", "/content/bootstrap.min.css");

            document.Push("div").AddClass("container");

            document.Add("h1").Text("TODO's");

            var todos = TodoTask.FindAllTodos(_top.AllTopicsInOrder().ToArray());

            document.Add(new TodoTableTag(todos));

            return document;
        }
        public HtmlDocument get_saml_poster()
        {
            var document = new HtmlDocument();
            document.Title = "Saml Poster";

            var form = new FormTag(_urls.UrlFor<SamlEndpoint>(x => x.post_test_saml()));

            document.Push(form);
            var textarea = form.Add("textarea").Attr("name", SamlAuthenticationStrategy.SamlResponseKey).Attr("rows", 20).Attr("cols", "100");
            if (SamlResponse != null)
            {
                var xml = _writer.Write(SamlResponse);
                textarea.Attr("value", xml);

                SamlResponse = null;
            }

            form.Add("input").Attr("type", "submit").Attr("value", "Submit").Id("saml-submit");

            return document;
        }
        public HtmlTag get_descriptions()
        {
            var document = new HtmlDocument();
            var top = document.Push("div");


            DescriptionBag.Each((name, description) =>
            {
                top.Add("h3").Text(name);
                top.Add("a").Text(name).Attr("href", _urls.UrlFor(new DescriptionRequest{
                    Name = name
                }));

                top.Add("p/i").Text(description.Title);
                top.Append(new DescriptionBodyTag(description));

                top.Add("hr");
                top.Add("b");
            });

            return top;
        }
        private HtmlDocument buildDocument(FileUploadOutput model)
        {
            var document = new HtmlDocument();
            document.Title = "File Upload View";

            document.Add("h1").Text(model.Text);

            document.Add("form")
                .Attr("method", "post")
                .Attr("enctype", "multipart/form-data")
                .Attr("action", _urls.UrlFor<FileUploadInput>());

            document.Add("br");

            document.Push("p");
            document.Add("span").Text("File 1:  ");
            document.Add("input").Attr("type", "file").Attr("name", "File1");

            
            document.Add("br");
            document.Add("input").Attr("type", "submit");

            return document;
        }