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_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 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;
        }
Exemple #4
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;
        }
        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 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;
        }
        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 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;
        }
Exemple #9
0
        public HtmlDocument Hello()
        {
            var document = new HtmlDocument();
            document.Add("h1").Text("Hello!");

            return document;
        }
 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;
 }
        public HtmlDocument Index()
        {
            var document = new HtmlDocument();
            document.Title = "The home page";
            document.Add("h1").Text("The home page");

            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;
        }
Exemple #14
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;
        }
Exemple #15
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;
        }
Exemple #16
0
        private void write500(IDictionary<string, object> environment, Exception exception)
        {
            using (var writer = new OwinHttpResponse(environment))
            {
                writer.WriteResponseCode(HttpStatusCode.InternalServerError);
                var document = new HtmlDocument
                {
                    Title = "Exception!"
                };

                document.Add("h1").Text("FubuMVC has detected an exception");
                document.Add("hr");
                document.Add("pre").Id("error").Text(exception.ToString());

                writer.WriteContentType(MimeType.Html.Value);
                writer.Write(document.ToString());
            }
        }
        public HtmlDocument Index()
        {
            var document = new HtmlDocument();

            document.Title = "FubuMVC.Diagnostics Harness";

            document.Add("a").Text("Diagnostics Home Page").Attr("href","_fubu");

            _graph.Behaviors.Each(chain =>
            {
                if (chain.Route != null)
                {
                    document.Add("p").Add("a").Text(chain.Route.Pattern).Attr("href", chain.GetRoutePattern());
                }
            });


            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 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;
        }
        public HtmlDocument get_blue()
        {
            var document = new HtmlDocument()
            {
                Title = "Blue!"
            };

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

            return document;
        }
        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 Routes_Summary()
 {
     //summary of changes since last branch
     var document = new HtmlDocument {Title = "Overview"};
     document.Add("p").Text("Moved controllers to new folder and namespace.");
     document.Add("p").Text("Added .IgnoreControllerNamespaceEntirely()");
     document.Add("p").Text("Added global.asax, calling AppStartFubuMVC.Start() in Application_Start");
     document.Add("p").Text("Removed web activator attribute from FubuMVC.cs");
     document.Add("p").Text("Removed getting started dll from fubu-content");
     document.Add("p").Text("Added .HomeIs<UrlPatternController>(x => x.Routes_Summary()) to ConfigureFubuMVC.cs");
     document.Add("p").Text("Demonstration of UrlPattern attribute and various usages in UrlPatternController.cs");
     document.Add("p").Text("Custom UrlPolicy in AllStringOutputRoutesAreSpecialPolicy.cs");
     return document;
 }
Exemple #23
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;
        } 
        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;
        }
        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 void Start(string description, DateTime runningTime)
        {
            _document = new HtmlDocument();
            _document.AddStyle(HtmlClasses.CSS());
            _document.Add("h1").Text(description);

            _document.AddJavaScript(HtmlClasses.JQuery());
            _document.AddJavaScript(HtmlClasses.SummaryFilter());
            _document.Add("div").Text("Executed at {0}".ToFormat(runningTime)).AddClass(HtmlClasses.CAPTION);

            _document.Add("hr");

            // _document and _table are HtmlTag objects
            _table = _document.Add("table");
            _table.Add("thead/tr", x =>
            {
                x.Add("th").Text("Test");
                x.Add("th").Text("Lifecycle");
                x.Add("th").Text("Result");
            });

            _tbody = _table.Add("tbody");
        }
        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 get_samples()
        {
            var document = new HtmlDocument {Title = "All Samples"};



            _cache.All().GroupBy(x => x.File).Each(group =>
            {
                var path = group.Key.PathRelativeTo(_settings.Root);
                document.Add("h3").Text(path);

                foreach (Sample sample in group)
                {
                    document.Add("h5").Text("{0} ({1})".ToFormat(sample.Name, sample.Language));
                    document.Add(new SampleTag(sample));
                }

                document.Add("hr");
            });


            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;
        }
        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);
        }