示例#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;
        }
示例#2
0
        public ResultsWriter(HtmlDocument document, ITestContext context)
        {
            _document = document;
            _context = context;

            _document.AddStyle(HtmlClasses.CSS());
        }
示例#3
0
        public string Generate(Topic topic)
        {
            if (topic.IsSplashPage())
            {
                return _transformer.Transform(topic, new FileSystem().ReadStringFromFile(topic.File));
            }

            try
            {
                return generate(topic);
            }
            catch (Exception e)
            {
                ConsoleWriter.Write(ConsoleColor.Yellow, "Failed to transform topic at " + topic.File);
                ConsoleWriter.Write(ConsoleColor.Red, e.ToString());

                var document = new HtmlDocument
                {
                    Title = "Error!"
                };

                document.Add("h1").Text("Error!");

                document.Add("pre").Text(e.ToString());


                return document.ToString();
            }
        }
 public HtmlDocument get_my_name_is_Name(NameModel input)
 {
     var document = new HtmlDocument();
     document.Title = "What's your name?";
     document.Add("h1").Text("My name is " + input.Name);
     return document;
 }
 public HtmlDocument Index(NavigationGenericInputModel model)
 {
     var document = new HtmlDocument();
     document.Title = "Navigation Generic Endpoint";
     document.Add("h1").Text("You navigated to an endpoint using a generic!");
     return document;
 }
示例#6
0
        public HtmlDocument Hello()
        {
            var document = new HtmlDocument();
            document.Add("h1").Text("Hello!");

            return document;
        }
        public HtmlDocument get_html_content()
        {
            var document = new HtmlDocument();
            document.Title = "Some Html";

            return document;
        }
        public HtmlDocument Index()
        {
            var document = new HtmlDocument();
            document.Title = "The home page";
            document.Add("h1").Text("The home page");

            return document;
        }
示例#9
0
        public HtmlDocument get_my_name_is_Name(MyNameIsInput input)
        {
            var document = new HtmlDocument();

            document.Add("h1").Text("My name is " + input.Name);

            return document;
        }
示例#10
0
        public HtmlDocument Welcome()
        {
            var document = new HtmlDocument();
            document.Title = "Fubu Testing Application";
            document.Add("h1").Text("Welcome to the FubuMVC Testing Application!");

            return document;
        }
        public HtmlDocument get_different_Name(DifferentInput input)
        {
            var document = new HtmlDocument();
            document.Title = "A different page";
            document.Add("h1").Text("Page for " + input.Name);

            return document;
        }
示例#12
0
        public PreviewWriter(HtmlDocument document, ITestContext context)
        {
            _document = document;
            _context = context;

            _document.AddStyle(HtmlClasses.CSS());

            _document.Push("div").AddClass("main");
        }
示例#13
0
        public HtmlDocument Index()
        {
            var document = new HtmlDocument();
            document.Title = "Serenity/Storyteller Harness";
            document.Add("h1").Text("Serenity/Storyteller Harness");

            document.Add("input").Attr("name", "foo").Id("foo").Attr("value", "bar");

            return document;
        }
示例#14
0
        public void OpenTo(Action<HtmlDocument> configure)
        {
            var document = new HtmlDocument();
            configure(document);
            var fileName = "doc.htm";

            document.WriteToFile(fileName);

            OpenTo(fileName);
        }
        public HtmlDocument get_reloaded()
        {
            var document = new HtmlDocument();
            document.Title = "Manual Test Harness for reloading";
            document.Add("h1").Text("Loaded at " + _reloaded.Timestamp);

            document.Add(new AutoReloadingTag(_runtime.Mode));

            return document;
        }
 public HtmlDocument ActionsThatTakeAnInputModel(MixColorInputModel input)
 {
     //can specify incoming route values to match model properties
     var document = new HtmlDocument
     {
         Title = "Mix Colors"
     };
     document.Add("p").Text("Mixing {0} with {1}".ToFormat(input.FirstColor, input.SecondColor));
     return document;
 }
        public void SetUp()
        {
            var document = new HtmlDocument();
            document.Add(new SelectTag(tag =>
            {
                tag.Option("a", "a");
                tag.Option("b", "2").Id("b");
                tag.Option("c", 3).Id("c");

                tag.SelectByValue("2");
            }).Name("select1").Id("select1"));

            document.Add(new SelectTag(tag =>
            {
                tag.Option("a", "a");
                tag.Option("b", 2).Id("b");
                tag.Option("c", 3).Id("c");

            }).Name("select2").Id("select2"));

            document.Add(new SelectTag(tag =>
            {
                tag.Add("option").Text("a");
                tag.Add("option").Text("b").Attr("selected", "selected");
                tag.Add("option").Text("c");

            }).Name("select3").Id("select3"));

            document.Add(new SelectTag(tag =>
            {
                tag.Option("a", "a");
                tag.Option("b", 2).Id("b");
                tag.Option("c", 3).Id("c");
                tag.Option("value", "b").Id("c");

                tag.SelectByValue(2);
            }).Name("select4").Id("select4"));

            document.WriteToFile("select.htm");

            try
            {
                startDriver();
            }
            catch (Exception)
            {
                Thread.Sleep(2000);
                startDriver();
            }

            select1 = theDriver.FindElement(By.Id("select1"));
            nothingSelectedElement = theDriver.FindElement(By.Id("select2"));
            select3 = theDriver.FindElement(By.Id("select3"));
            select4 = theDriver.FindElement(By.Id("select4"));
        }
        public static HtmlDocument AsHtmlDocument(this Notification notification)
        {
            var doc = new HtmlDocument();
            var body = new HtmlTag("h1").Text(notification.Title);
            doc.RootTag.Add("body");
            body.Next = new HtmlTag("p").Text(notification.NotificationDate.ToShortDateString() + " - Author: " + notification.Author.Name + " (" + notification.Author.Email + ")");
            body.Next.Next = new HtmlTag("p").Text(notification.Description);
            doc.Add(body);

            return doc;
        }
示例#19
0
        public HtmlDocument get_blue()
        {
            var document = new HtmlDocument()
            {
                Title = "Blue!"
            };

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

            return document;
        }
示例#20
0
        public HtmlDocument get_login(LoginRequest request)
        {
            var document = new HtmlDocument();
            document.Title = "Login Page";

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

            document.Add("div").Id("message").Text(request.Message);

            return document;
        }
        private void writeFailedFixture(HtmlDocument document, FixtureGraph fixture)
        {
            document.Add("h3").Text("Fixture:  " + fixture.Name);

            fixture.Errors.Each(e =>
            {
                document.Add("div").Child(new ExceptionTag(e.ErrorText));
            });

            document.Add("hr");
        }
        public static HtmlDocument BuildResults(BatchRunResponse results)
        {
            var document = new HtmlDocument
            {
                Title = "Storyteller Batch Results for {0}: {1}".ToFormat(results.system, results.suite)
            };

            WriteCSS(document);
            writeJavascript(results, document);

            return document;
        }
        public HtmlDocument get_occasional_error_HelloText(OccasionalInput inputModel)
        {
            var rand = new Random();
            if (rand.Next(0, 100) < 10)
            {
                throw new Exception("Boom");
            }

            var document = new HtmlDocument();
            document.Add("h1").Text(inputModel.HelloText);

            return document;
        }
示例#24
0
        public HtmlDocument get_all_routes()
        {
            var document = new HtmlDocument
            {
                Title = "All the routes"
            };

            _graph.Behaviors.Each(x => {
                document.Add("p").Text(x.ToString());
            });

            return document;
        } 
        private static void writeJavascript(BatchRunResponse results, HtmlDocument document)
        {
            var cleanJson = JsonSerialization.ToCleanJson(results);

            document.Body.Add("div").Hide().Id("batch-data").Text(cleanJson);
            document.Body.Add("div").Id("main");

            var js = readFile("StoryTeller.batch-bundle.js");

            var foot = new HtmlTag("foot");
            document.Body.Next = foot;
            foot.Add("script").Attr("language", "javascript").Text("\n\n" + js + "\n\n").Encoded(false);
        }
示例#26
0
        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;
        }
示例#27
0
        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;
        }
示例#28
0
        public static HtmlDocument BuildDocument(string title, params HtmlTag[] tags)
        {
            var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof(BehaviorGraphWriter), "diagnostics.css");
            var reader = new StreamReader(stream);
            var css = reader.ReadToEnd();

            var document = new HtmlDocument();
            document.Title = title;
            tags.Each(x => document.Add(x));

            document.AddStyle(css);

            return document;
        }
        public HtmlDocument Products_Id(ViewProductRequest request)
        {
            var product = _crudService.Retrieve(request.Id);

            var document = new HtmlDocument();
            var container = new DivTag("");

            container.Append(new HtmlTag("h1").Text(product.Number + " - " + product.Name));
            container.Append(new HtmlTag("h2").Text("$" + product.Price.ToString("F2")));
            container.Append(new HtmlTag("h3").Text(product.Description));

            document.Add(container);
            return document;
        }
        public HtmlDocument BlueHello()
        {
            var document = new HtmlDocument
            {
                Title = "Saying hello to you"
            };

            document
                .Add("h1")
                .Text("Hello world!")
                .Style("color", "blue");

            return document;
        }
示例#31
0
        public static void ExportToHtmFile(string fileName, params IValidator[] validators)
        {
            bool all = false;

            while (true)
            {
                Console.Write("Please enter the type of validations to run (All/Populars)[a/p]:p");
                Console.SetCursorPosition(Console.CursorLeft - 1, Console.CursorTop);
                var k = Console.ReadKey();

                if (k.Key == ConsoleKey.A)
                {
                    all = true;
                    break;
                }

                if (k.Key == ConsoleKey.P || k.Key == ConsoleKey.Enter)
                {
                    all = false;
                    break;
                }
            }


            var doc = new HtmlTags.HtmlDocument();


            doc.Head
            .Add("description").Attr("content", "Some validations of BriefFiniteEelement.NET library")
            .Parent.Add("keywords").Attr("content",
                                         "finite element, C#, FEA, FEM, BriefFiniteEelement.NET, BriefFiniteEelementDOTNET")
            .Parent.Add("viewport").Attr("content", "width=device-width, initial-scale=1")

            .Parent.Add("link").Attr("rel", "stylesheet").Attr("crossorigin", "anonymous").Attr("href", "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css").Attr("integrity", "sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm").Text(" ")
            .Parent.Add("script").Attr("crossorigin", "anonymous").Attr("src", "https://code.jquery.com/jquery-3.2.1.slim.min.js").Attr("integrity", "sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN").Text(" ")
            .Parent.Add("script").Attr("crossorigin", "anonymous").Attr("src", "https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js").Attr("integrity", "sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q").Text(" ")
            .Parent.Add("script").Attr("crossorigin", "anonymous").Attr("src", "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js").Attr("integrity", "sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl").Text(" ")
            ;

            //doc.ReferenceJavaScriptFile("https://code.jquery.com/jquery-3.2.1.slim.min.js");
            ;

            /*
             * doc.AddScript("javascript","https://code.jquery.com/jquery-3.2.1.slim.min.js");
             * doc.AddJavaScript("https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js");
             * doc.AddJavaScript("https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js");
             *
             * doc.AddStyle("https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css");
             *
             */
            doc.Title = "BriefFiniteElement Validtion Cases";

            var body = doc.Body;

            body.Add("noscript")
            .Text(
                "This page needs javascript to be enabled in your webbrowser, otherwise page will be a little illegible");

            body.Style("padding", "60px");

            body.Add("script").Attr("type", "text/javascript")
            .Text(
                @"$(document).ready(function(){jQuery?void(0):alert('jquery not loaded')});");



            var ctx = body.Add("div").Id("ctxtbl").AddClass("jumbotron");

            ctx.Add("div").Add("p").Text("Table of contents:");

            body = body.Add("div").AddClass("container");

            foreach (var validator in validators)
            {
                var valReses = all ?
                               validator.DoAllValidation() :
                               validator.DoPopularValidation();

                foreach (var valRese in valReses)
                {
                    var id = Guid.NewGuid().ToString("N").Substring(0, 5);

                    var validationSpan = body.Add("div").Id(id).AddClasses("card");


                    validationSpan.Add("div").AddClasses("card-header").Text("Validation");//title


                    var blc = validationSpan.Add("div").AddClasses("card-block");

                    blc.Add("h4").AddClasses("card-title").Text(valRese.Title);
                    var panelBody = blc.Add("div").AddClasses("card-text");


                    panelBody.Children.Add(valRese.Span);

                    if (valRese.ValidationFailed.HasValue)
                    {
                        var fail = valRese.ValidationFailed.Value;

                        var sp2 = validationSpan.Add("div").AddClass("alert").AddClass(fail? "alert-danger" : "alert-success").Attr("role", "alert");

                        sp2.Text(fail ? "Validation Failed!!" : "Validation Success!!");
                        //body.Children.Add(sp2);
                    }



                    ctx.Add("a").Attr("href", "#" + id).Text(valRese.Title);
                    ctx.Add("br");
                }
            }

            var fl = "c:\\temp\\val-res.html";

            var xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(doc.ToString());

            xmlDoc.Save(fl);


            Process.Start(fl);
        }