Пример #1
0
        /// <summary>
        /// Renders a monitor of The Others using Twitter Bootstrap components.
        /// </summary>
        /// <param name="ui">The Other UI.</param>
        /// <returns>The html.</returns>
        public static TheOthersUI BootstrapMonitor(this TheOthersUI ui)
        {
            var others = ExternalDependencyService.CheckAllStatus();

            foreach (var other in others)
            {
                var panelClass = other.Status.IsFailing ? "danger" : "success";

                ui.Html.AppendFormat(
                    @" 
                <div class='panel panel-{0}'>
                    <div class='panel-heading'>
                        <h3 class='panel-title'>{1}</h3>
                    </div>
                    <div class='panel-body'>
                        {2}
                    </div>
                </div>",
                    panelClass,
                    other.Name,
                    other.Status.Description);
            }

            return(ui);
        }
Пример #2
0
        public void CheckAllStatus_NoArgs_AllOthersWithUpdatedStatus()
        {
            var actual = ExternalDependencyService.CheckAllStatus();

            Assert.AreEqual(1, actual.Count);
            Assert.AreEqual("Stub 1", actual [0].Name);
            Assert.IsNotNull(actual [0].Status);
        }
Пример #3
0
        /// <summary>
        /// Renders a monitor of The Others using a basic html table.
        /// </summary>
        /// <param name="ui">The Other UI.</param>
        /// <returns>The html.</returns>
        public static TheOthersUI BasicTableMonitor(this TheOthersUI ui)
        {
            var others = ExternalDependencyService.CheckAllStatus();

            ui.Html.Append("<table border='1' width='100%'><tr><th>Name</th><th>Is failing?</th><th>Description</th></tr>");

            foreach (var other in others)
            {
                ui.Html.AppendFormat(
                    @" 
                <tr>
                    <td>{0}</td>
                    <td>{1}</td>
                    <td>{2}</td>
                </tr>",
                    other.Name,
                    other.Status.IsFailing,
                    other.Status.Description);
            }

            ui.Html.Append("</table>");

            return(ui);
        }