Esempio n. 1
0
        public void Should_be_able_to_dispose_of_an_explicit_instance_without_affecting_standard_instance()
        {
            SeleniumSupport target = CreateTarget(true);

            const string serverHost    = "localhost";
            const int    serverPort    = 4444;
            string       browserString = _firefoxBrowser;

            ISelenium defaultInstance = target.Start(serverHost, serverPort, browserString, "http://www.google.co.uk");

            Assert.IsNotNull(defaultInstance);
            Assert.AreEqual(1, target.Instances.Count);

            ISelenium explicitInstance = target.CreateInstance(serverHost, serverPort, browserString, "http://www.microsoft.com");

            Assert.IsNotNull(explicitInstance);
            Assert.AreEqual(2, target.Instances.Count);
            Assert.AreNotSame(defaultInstance, explicitInstance);
            Assert.AreSame(target.Selenium, defaultInstance);


            target.DisposeInstance(explicitInstance);
            Assert.AreEqual(1, target.Instances.Count);
            Assert.IsNotNull(target.Selenium);

            // Dispose of class to clear up resources
            target.Dispose();
        }
Esempio n. 2
0
        public void Should_start_default_selenium_instance_of_ie()
        {
            SeleniumSupport target = CreateTarget(true);

            const string serverHost    = "localhost";
            const int    serverPort    = 4444;
            string       browserString = _ieBrowser;
            const string browserUrl    = "http://www.google.co.uk";

            ISelenium actual = target.Start(serverHost, serverPort, browserString, browserUrl);

            Assert.IsNotNull(actual);
            Assert.AreEqual(1, target.Instances.Count);
            Assert.AreSame(target.Selenium, actual);

            // Dispose of the selenium support instance otherwise tests to ensure errors thrown when
            // it is not running will not work
            target.Dispose();
        }
Esempio n. 3
0
        public void Should_thow_exception_when_starting_instance_due_to_url_not_provided()
        {
            SeleniumSupport target = CreateTarget(true);

            target.Start("localhost", 4444, _firefoxBrowser, "");
        }
Esempio n. 4
0
        public void Should_thow_exception_when_starting_instance_due_to_browser_string_not_provided()
        {
            SeleniumSupport target = CreateTarget(true);

            target.Start("localhost", 4444, "", "http://www.google.co.uk");
        }
Esempio n. 5
0
        public void Should_thow_exception_when_starting_instance_due_to_serverhost_not_provided()
        {
            SeleniumSupport target = CreateTarget(true);

            target.Start("", 4444, _firefoxBrowser, "http://www.google.co.uk");
        }