public void DefaultConstructor1GeneratesDefaultValues(int timeoutInMillisseconds)
        {
            IWait <IWebDriver> wait = new ImmutableWait(
                driver,
                TimeSpan.FromMilliseconds(timeoutInMillisseconds));

            using (new AssertionScope())
            {
                wait.Timeout.Should().Be(TimeSpan.FromMilliseconds(timeoutInMillisseconds));
                wait.Message.Should().Be(string.Empty);
                wait.PollingInterval.Should().Be(TimeSpan.FromMilliseconds(500));
            }
        }
        public void TryingToSetTimeoutFailsSilently()
        {
            TimeSpan initialTimeout = TimeSpan.FromSeconds(30);

            Trace.WriteLine($"Test: {nameof(TryingToSetTimeoutFailsSilently)} should log an error below.");
            IWait <IWebDriver> wait = new ImmutableWait(
                driver,
                initialTimeout);

            wait.Timeout = TimeSpan.FromSeconds(3);
            Trace.WriteLine($"Test: {nameof(TryingToSetTimeoutFailsSilently)} should have logged an error above.");

            wait.Timeout.Should().Be(initialTimeout);
        }
        public void TryingToModifyIgnoredExceptionsThrowsException()
        {
            TimeSpan initialTimeout = TimeSpan.FromSeconds(30);

            Trace.WriteLine($"Test: {nameof(TryingToSetTimeoutFailsSilently)} should log an error below.");
            IWait <IWebDriver> wait = new ImmutableWait(
                driver,
                initialTimeout);

            Action act = () => wait.IgnoreExceptionTypes(new Type[] { typeof(WebDriverException) });

            act.Should().Throw <InvalidOperationException>()
            .WithMessage("Unsupported attempt to modify the ignored Exceptions of the immutable Wait for ImmutableWebDriverWaitTests");
        }
        public void TryingToSetAMessageFailsSilently()
        {
            TimeSpan initialTimeout = TimeSpan.FromSeconds(30);

            IWait <IWebDriver> wait = new ImmutableWait(
                driver,
                initialTimeout);

            Trace.WriteLine($"Test: {nameof(TryingToSetAMessageFailsSilently)} should log an error below.");
            wait.Message = "This is a new message";
            Trace.WriteLine($"Test: {nameof(TryingToSetAMessageFailsSilently)} should log an error below.");

            wait.Message.Should().Be(string.Empty);
        }
        public void TryingToSetPollingIntervalFailsSilently()
        {
            TimeSpan initialTimeout = TimeSpan.FromSeconds(30);

            IWait <IWebDriver> wait = new ImmutableWait(
                driver,
                initialTimeout);


            Trace.WriteLine($"Test: {nameof(TryingToSetPollingIntervalFailsSilently)} should log an error below.");
            wait.PollingInterval = TimeSpan.FromMilliseconds(250);
            Trace.WriteLine($"Test: {nameof(TryingToSetPollingIntervalFailsSilently)} should log an error below.");

            wait.PollingInterval.Should().Be(TimeSpan.FromMilliseconds(500));
        }