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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 10
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);
        }
        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"]);
        }
Esempio n. 12
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);
        }
Esempio n. 13
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);
        }
Esempio n. 14
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);
        }
Esempio n. 15
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);
        }
Esempio n. 16
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);
        }
Esempio n. 17
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);
        }
Esempio n. 18
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);
        }
Esempio n. 19
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);
        }