コード例 #1
0
        public void TestTearDownAfterScenarioWhenReuseBrowserIsTrue()
        {
            // arrange
            BrowserFactoryConfiguration config = new BrowserFactoryConfiguration
            {
                ReuseBrowser = true
            };

            var browserFactory = new Mock <BrowserFactory>(config);

            WebDriverSupport.SetBrowserFactory(browserFactory.Object);

            var browser = new Mock <IBrowser>(MockBehavior.Loose);

            WebDriverSupport.SetCurrentBrowser(browser.Object);

            // act
            WebDriverSupport.TearDownAfterScenario();

            // assert
            browser.Verify(b => b.Close(true), Times.Never());
        }
コード例 #2
0
        public void TestTearDownAfterScenarioWhenReuseBrowserIsTrue()
        {
            // arrange
            var config = new ConfigurationSectionHandler
            {
                BrowserFactory =
                    new BrowserFactoryConfigurationElement
                {
                    ReuseBrowser = true
                }
            };

            var browser = new Mock <IBrowser>(MockBehavior.Loose);

            WebDriverSupport.Browser             = browser.Object;
            WebDriverSupport.ConfigurationMethod = new Lazy <ConfigurationSectionHandler>(() => config);

            // act
            WebDriverSupport.TearDownAfterScenario();

            // assert
            browser.Verify(b => b.Close(true), Times.Never());
        }