Esempio n. 1
0
        public void CreateFromConfig_NullConfig_ThrowsArgumentNullException()
        {
            // Arrange
            IWebDriverConfig config = null;

            // Act
            TestDelegate action = () => WebDriverFactory.CreateFromConfig(config);

            // Assert
            Assert.Throws <ArgumentNullException>(action);
        }
Esempio n. 2
0
        public void CreateFromConfig_WhenNoneWebDriver_ThrowArgumentException()
        {
            // arrange
            IWebDriverConfig config = new NoneWebDriverConfigStub();

            // act
            TestDelegate action = () => WebDriverFactory.CreateFromConfig(config);

            // assert
            Assert.Throws <ArgumentException>(action);
        }
        public ISessionPerformer Initialize(IWebDriverConfig webDriverConfig, ISessionTracker tracker)
        {
            if (webDriverConfig == null)
            {
                throw new ArgumentNullException(nameof(webDriverConfig));
            }

            if (_initialized)
            {
                throw new InvalidOperationException($"{nameof(SequentialSessionPerformer)} can be initialized only once.");
            }

            _webDriver = new Lazy <IWebDriver>(() => WebDriverFactory.CreateFromConfig(webDriverConfig));
            _tracker   = tracker ?? throw new ArgumentNullException(nameof(tracker));

            _initialized = true;
            return(this);
        }