Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
        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);
        }
Beispiel #8
0
        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);
        }
Beispiel #9
0
        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);
        }
Beispiel #10
0
        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);
        }
Beispiel #11
0
        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);
        }
Beispiel #12
0
        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);
        }
Beispiel #13
0
        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);
        }
Beispiel #14
0
        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);
        }
Beispiel #15
0
        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);
        }
Beispiel #16
0
        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);
        }