public void DeserializeJsonThrowsIfNoExtensionsReference() { MockAspNetService mockAspNetService = new MockAspNetService(); SystemWebExtensionsWrapper swe = new SystemWebExtensionsWrapper(mockAspNetService); swe.SystemWebExtensionsAssembly = null; swe.DeserializeJson("{\"foo\":\"bar\"}"); }
public void Initialize() { MockAspNetService mockAspNetService = new MockAspNetService(); SystemWebExtensionsWrapper swe = new SystemWebExtensionsWrapper(mockAspNetService); UnitTestAssert.IsNull(swe.RegisterStartupScriptMethodInfo); swe.Initialize(new Page()); UnitTestAssert.IsNotNull(swe.RegisterStartupScriptMethodInfo); }
public void TestcasesTreeView_LoadAddsRootNode() { MockAspNetService mockAspNet = new MockAspNetService(); TestDriverPage page = new TestDriverPage(mockAspNet); page.TestCasesTreeView = new TreeView(); page.TestcasesTreeview_LoadInternal(); UnitTestAssert.AreEqual(1, page.TestCasesTreeView.Nodes.Count); UnitTestAssert.AreEqual("All Test Cases", page.TestCasesTreeView.Nodes[0].Text); }
public void GenerateInterfaceRegistersScriptBlock() { MockAspNetService mockAspNet = new MockAspNetService(); mockAspNet.FindControlResults.Add("DriverPageContentPlaceHolder", new PlaceHolder()); TestDriverPage page = new TestDriverPage(mockAspNet); page.GenerateInterface(); UnitTestAssert.AreEqual(1, mockAspNet.ClientScriptBlocks.Count); }
public void GenerateInterfaceCreatesPlaceHolder() { MockAspNetService mockAspNet = new MockAspNetService(); PlaceHolder holder = new PlaceHolder(); mockAspNet.FindControlResults.Add("DriverPageContentPlaceHolder", holder); TestDriverPage page = new TestDriverPage(mockAspNet); page.GenerateInterface(); UnitTestAssert.AreSame(holder, page.ContentPlaceHolder); }
public void GenerateInterfaceCreatesThreadLabel() { MockAspNetService mockAspNet = new MockAspNetService(); mockAspNet.FindControlResults.Add("DriverPageContentPlaceHolder", new PlaceHolder()); TestDriverPage page = new TestDriverPage(mockAspNet); page.GenerateInterface(); Label control = (Label)page.ContentPlaceHolder.Controls[0].Controls[1].Controls[6].Controls[5]; UnitTestAssert.AreEqual("ThreadId", control.ID); }
public void GenerateInterfaceCreatesRunFailedTestsButton() { MockAspNetService mockAspNet = new MockAspNetService(); mockAspNet.FindControlResults.Add("DriverPageContentPlaceHolder", new PlaceHolder()); TestDriverPage page = new TestDriverPage(mockAspNet); page.GenerateInterface(); Button control = (Button)page.ContentPlaceHolder.Controls[0].Controls[1].Controls[6].Controls[1]; UnitTestAssert.AreEqual("failedTests", control.ID); }
public void GenerateInterfaceCreatesShowConsoleCheckbox() { MockAspNetService mockAspNet = new MockAspNetService(); mockAspNet.FindControlResults.Add("DriverPageContentPlaceHolder", new PlaceHolder()); TestDriverPage page = new TestDriverPage(mockAspNet); page.GenerateInterface(); CheckBox control = (CheckBox)page.ContentPlaceHolder.Controls[0].Controls[1].Controls[2]; UnitTestAssert.AreEqual("ShowConsoleCheckBox", control.ID); }
public void GenerateInterfaceCreatesHelpIcon() { MockAspNetService mockAspNet = new MockAspNetService(); mockAspNet.FindControlResults.Add("DriverPageContentPlaceHolder", new PlaceHolder()); TestDriverPage page = new TestDriverPage(mockAspNet); page.GenerateInterface(); Image control = (Image)page.ContentPlaceHolder.Controls[0].Controls[0].Controls[1]; UnitTestAssert.AreEqual("help", control.ID); }
public void GenerateInterfaceCreatesTreeView() { MockAspNetService mockAspNet = new MockAspNetService(); mockAspNet.FindControlResults.Add("DriverPageContentPlaceHolder", new PlaceHolder()); TestDriverPage page = new TestDriverPage(mockAspNet); page.GenerateInterface(); TreeView control = (TreeView)page.ContentPlaceHolder.Controls[1].Controls[0]; UnitTestAssert.AreEqual("testcasesTreeView", control.ID); }
public void DeserializeJsonDictionary() { MockAspNetService mockAspNetService = new MockAspNetService(); SystemWebExtensionsWrapper swe = new SystemWebExtensionsWrapper(mockAspNetService); swe.SystemWebExtensionsAssembly = Assembly.GetAssembly(typeof(ScriptManager)); object o = swe.DeserializeJson("{\"foo\":\"bar\"}"); UnitTestAssert.IsNotNull(o); Dictionary <string, object> dic = (Dictionary <string, object>)o; UnitTestAssert.AreEqual("bar", dic["foo"]); }
public void OnInit_NoUI() { MockAspNetService mockAspNet = new MockAspNetService(); mockAspNet.SetIsPostBack(false); TestDriverPage page = new TestDriverPage(mockAspNet); page.TestCasesTreeView = new System.Web.UI.WebControls.TreeView(); page.AutoGenerateInterface = false; page.OnInitInternal(); UnitTestAssert.IsNull(page.ThreadIdLabel); }
public void GenerateInterfaceCreatesCommandsArea() { MockAspNetService mockAspNet = new MockAspNetService(); mockAspNet.FindControlResults.Add("DriverPageContentPlaceHolder", new PlaceHolder()); TestDriverPage page = new TestDriverPage(mockAspNet); page.GenerateInterface(); Panel control = (Panel)page.ContentPlaceHolder.Controls[2].Controls[2]; UnitTestAssert.AreEqual("TraceConsole", control.ID); }
public void GenerateInterfaceCreatesSpinnerImage() { MockAspNetService mockAspNet = new MockAspNetService(); mockAspNet.FindControlResults.Add("DriverPageContentPlaceHolder", new PlaceHolder()); TestDriverPage page = new TestDriverPage(mockAspNet); page.GenerateInterface(); //headerDiv.MenuPanel.ButtonPanel HtmlImage control = (HtmlImage)page.ContentPlaceHolder.Controls[0].Controls[1].Controls[6].Controls[3]; UnitTestAssert.AreEqual("spinner", control.ID); }
public void GenerateInterfaceCreatesTestsDiv() { MockAspNetService mockAspNet = new MockAspNetService(); mockAspNet.FindControlResults.Add("DriverPageContentPlaceHolder", new PlaceHolder()); TestDriverPage page = new TestDriverPage(mockAspNet); page.GenerateInterface(); Panel control = (Panel)page.ContentPlaceHolder.Controls[1]; UnitTestAssert.AreEqual("Tests", control.ID); UnitTestAssert.AreEqual("tests", control.CssClass); }
public void OnInit_NoLocators() { ServiceLocator.ApplicationPathFinder = null; ServiceLocator.BrowserCommandExecutorFactory = null; MockAspNetService mockAspNet = new MockAspNetService(); mockAspNet.SetIsPostBack(true); TestDriverPage page = new TestDriverPage(mockAspNet); page.TestCasesTreeView = new System.Web.UI.WebControls.TreeView(); page.AutoGenerateInterface = false; page.OnInitInternal(); UnitTestAssert.IsNull(ServiceLocator.ApplicationPathFinder); UnitTestAssert.IsNull(ServiceLocator.BrowserCommandExecutorFactory); }
public void OnLoadComplete_HidesConsoleIfCheckboxIsNotSet() { MockAspNetService mockAspNet = new MockAspNetService(); mockAspNet.SetIsPostBack(true); TestDriverPage page = new TestDriverPage(mockAspNet); page.ShowConsoleCheckBox = new CheckBox(); page.ShowConsoleCheckBox.Checked = false; page.TestsPanel = new Panel(); page.FooterPanel = new Panel(); page.OnLoadCompleteInternal(); UnitTestAssert.AreEqual("testsNoConsole", page.TestsPanel.CssClass); UnitTestAssert.IsFalse(page.FooterPanel.Visible); }
public void TestcasesTreeView_LoadSelectsNodesIfTargetIsTreeview() { MockAspNetService mockAspNet = new MockAspNetService(); NameValueCollection form = new NameValueCollection(); form.Add("__EVENTTARGET", null); mockAspNet.SetRequestForm(form); mockAspNet.SetIsPostBack(true); TestDriverPage page = new TestDriverPage(mockAspNet); page.TestCasesTreeView = new TreeView(); TreeNode rootNode = new TreeNode("Foobar"); rootNode.Checked = true; page.TestCasesTreeView.Nodes.Add(rootNode); page.TestcasesTreeview_LoadInternal(); UnitTestAssert.IsTrue(rootNode.Checked); }
public void OnLoadComplete_ShowConsoleFromQueryString() { MockAspNetService mockAspNet = new MockAspNetService(); mockAspNet.SetIsPostBack(false); NameValueCollection col = new NameValueCollection(); col.Add("console", "false"); mockAspNet.SetQueryString(col); TestDriverPage page = new TestDriverPage(mockAspNet); page.WriteLogToDiskCheckBox = new CheckBox(); page.ShowConsoleCheckBox = new CheckBox(); page.FooterPanel = new Panel(); page.TestsPanel = new Panel(); page.OnLoadCompleteInternal(); UnitTestAssert.AreEqual("testsNoConsole", page.TestsPanel.CssClass); UnitTestAssert.IsFalse(page.FooterPanel.Visible); }