public static string CheckBox(bool isChecked, bool isDisabled = false, int leadingSpaces = 4, string value = "") { var el = new HtmlElement("input"); el.Attributes.Add("type", "checkbox"); el.Attributes.Add("checked", isChecked ? "checked" : ""); el.Attributes.Add("disabled", isDisabled ? " disabled " : ""); el.Attributes.Add("value", value); return IndentWithSpaces(leadingSpaces) + el.ToString(); }
public void HtmlElementCreate_Pre() { var element = new HtmlElement("pre"); element.text = "This is a PRE"; var expected = String.Format("<pre>This is a PRE</pre>"); var actual = element.ToString(); Assert.AreEqual(expected, actual); }
public void HtmlElementCreate_Span() { var element = new HtmlElement("span"); element.Attributes.Add("id", ""); element.Attributes.Add("style", "text-decoration:underline;"); element.text = "This is a span"; var expected = String.Format("<span id=\"\" style=\"text-decoration:underline;\">This is a span</span>"); var actual = element.ToString(); Assert.AreEqual(expected, actual); }
public void HtmlElementCreate_Div() { var element = new HtmlElement("div"); element.Attributes.Add("id", "divId"); element.Attributes.Add("class", "divClass"); element.text = "This is a DIV"; var expected = String.Format("<div id=\"divId\" class=\"divClass\">This is a DIV</div>"); var actual = element.ToString(); Assert.AreEqual(expected, actual); }
public void HtmlElementCreate_CheckBox() { var element = new HtmlElement("input"); element.Attributes.Add("id", "checkBoxId"); element.Attributes.Add("type", "checkbox"); element.Attributes.Add("checked", "checked"); element.Attributes.Add("value", "This is a CheckBox"); var expected = "<input id=\"checkBoxId\" type=\"checkbox\" checked value=\"This is a CheckBox\" />"; var actual = element.ToString(); Assert.AreEqual(expected, actual); }
public void HtmlElementCreate_A() { var element = new HtmlElement("a"); element.Attributes.Add("id", "aaa"); element.Attributes.Add("class", "ShowMore"); element.Attributes.Add("href", "http"); element.Attributes.Add("title", "Click me please!!!"); element.text = "Click here"; var expected = String.Format("<a id=\"aaa\" class=\"ShowMore\" href=\"http\" title=\"Click me please!!!\">Click here</a>"); var actual = element.ToString(); Assert.AreEqual(expected, actual); }
public static string AddLinkToHiddenContent(string rawContent, bool visible = false) { string divId = Guid.NewGuid().ToString().Substring(0, 8); var el = new HtmlElement("a") { text = visible ? ShowLess : ShowMore }; el.Attributes.Add("href", "#"); el.Attributes.Add("class", "ShowMore"); el.Attributes.Add("title", "Click here to show/hide additional content"); var div = new HtmlElement("div") { text = rawContent }; var className = visible ? "" : "dontShow"; div.Attributes.Add("class", ".hidable " + className); return el.ToString() + div.ToString(); }
public void HtmlElementCreate_RadioBox() { var element = new HtmlElement("input"); element.Attributes.Add("type", "radio"); element.Attributes.Add("class", ""); element.Attributes.Add("name", ""); element.Attributes.Add("checked", "checked"); element.Attributes.Add("disabled", "disabled"); element.Attributes.Add("value", "This is a radio box"); var expected = String.Format("<input type=\"radio\" class=\"\" name=\"\" checked disabled value=\"This is a radio box\" />"); var actual = element.ToString(); Assert.AreEqual(expected, actual); }
public static string I(string innerHTML) { var i = new HtmlElement("span") { text = innerHTML }; i.text = innerHTML; i.Attributes.Add("style", "font-style:italic;"); return i.ToString(); }
public static String U(String innerHTML) { var el = new HtmlElement("span") { text = innerHTML }; el.Attributes.Add("style", "text-decoration:underline;"); return el.ToString(); }
public static string Radio(bool isChecked, int leadingSpaces = 4, string value = "") { var el = new HtmlElement("input"); el.Attributes.Add("type", "radio"); el.Attributes.Add("checked", isChecked ? "checked" : ""); el.Attributes.Add("value", value); return IndentWithSpaces(leadingSpaces) + el.ToString(); }
protected override void Collect() { var link = new HtmlElement("a") { text = "View Readme" }; link.Attributes.Add("target", "_blank"); link.Attributes.Add("href", "file:///" + ProductDetection.Vugen.InstallLocation + "dat/Readme.htm"); string readme = ProductDetection.isFullLRInstalled ? link.ToString() : ""; string title = "LoadRunner Information"; string lrInfo = String.Format("{0} {1} {2} {3} {4}", Html.BoolToYesNo(ProductDetection.isFullLRInstalled), ProductDetection.FullLR.ProductName, ProductDetection.FullLR.ProductVersion, Helper.ConvertInstallDate(ProductDetection.FullLR.InstallDate), readme); AddDataPair(title, "Is full LoadRunner installed?", lrInfo); //If Full LR or PC HOST are not installed: if (!ProductDetection.isFullLRInstalled) { string vugenSAInfo = ProductDetection.Vugen.IsInstalled ? ProductDetection.Vugen.GetProductNameVersionDateFormatted() + " " + link : "No"; AddDataPair(title, "Is VuGen stand-alone installed?", vugenSAInfo); AddDataPair(title, "Is Analysis stand-alone installed?", ProductDetection.Analysis.GetProductNameVersionDateFormatted()); AddDataPair(title, "Is Load Generator installed?", ProductDetection.Loadgen.GetProductNameVersionDateFormatted()); AddDataPair(title, "Is Monitor Over Firewall installed?", ProductDetection.monitorOverFirewall.GetProductNameVersionDateFormatted()); AddDataPair(title, "Is PC Server installed?", ProductDetection.pcServer.GetProductNameVersionDateFormatted()); AddDataPair(title, "Is MI Listener installed?", ProductDetection.miListener.GetProductNameVersionDateFormatted()); } // Display patches installed for the products. If a product is not install patchesInstalled will return empty string if (ProductDetection.installedProducts.Count > 0) { StringBuilder customComponentsInstalled = new StringBuilder(1024); StringBuilder mainExecutableFiles = new StringBuilder(1024); //StringBuilder importantRegKeys = new StringBuilder(1024); StringBuilder environmentVariables = new StringBuilder(1024); StringBuilder patchesInstalledInfo = new StringBuilder(1024); var languagePacks = new StringBuilder(); foreach (var installedProduct in ProductDetection.installedProducts) { customComponentsInstalled.Append(installedProduct.CustomComponentsInstalled); mainExecutableFiles.Append(installedProduct.mainExecutableFilesInfo); //importantRegKeys.Append(installedProduct.ImportantRegKeyValues); environmentVariables.Append(installedProduct.environmentVariables); patchesInstalledInfo.Append(installedProduct.patchesInstalled); languagePacks.Append(installedProduct.languagePack); } // Collect the patches for the installed products string patchesInstalled = (patchesInstalledInfo.ToString() != "") ? patchesInstalledInfo.ToString() : "None"; AddDataPair(title, "Patches installed", patchesInstalled); AddDataPair(title, "Language pack", languagePacks.ToString()); AddDataPair(title, "Custom components installed", customComponentsInstalled.ToString()); AddDataPair(title, "Main executable files", mainExecutableFiles.ToString()); //AddStringsToDictionary("LoadRunner Information", "Various registry keys", importantRegKeys.ToString()); // check if we only have MOF installed if (ProductDetection.monitorOverFirewall.IsInstalled && (!ProductDetection.Vugen.IsInstalled || !ProductDetection.Loadgen.IsInstalled)) AddDataPair(title, "Related environment variables", ProductDetection.monitorOverFirewall.environmentVariables); else AddDataPair(title, "Related environment variables", environmentVariables.ToString()); } }
public override string ToString() { StringBuilder output = new StringBuilder(); //Create HTML checkbox var el = new HtmlElement("input"); el.Attributes.Add("type", "checkbox"); el.Attributes.Add("checked", enabled ? "checked" : ""); string ruleText; if (isRegex) ruleText = " Regex rule: " + lb; else if (isXpath) ruleText = " Xpath rule: " + lb; else ruleText = " LB=\"" + lb + "\" RB=\"" + rb + "\""; output.Append(Html.IndentWithSpaces(8)); output.Append(el.ToString() + Html.B(name) + ruleText); return output.ToString(); }