Beispiel #1
0
        public void ShouldThrowIfEmptyParameterPassed()
        {
            var values = new string[] { "val1", "" };

            SetupVerifiableAxeInjectionCall();

            var builder = new AxeBuilder(webDriverMock.Object);

            VerifyExceptionThrown <ArgumentException>(() => builder.WithRules(values));
            VerifyExceptionThrown <ArgumentException>(() => builder.DisableRules(values));
            VerifyExceptionThrown <ArgumentException>(() => builder.WithTags(values));
            VerifyExceptionThrown <ArgumentException>(() => builder.Include(values));
            VerifyExceptionThrown <ArgumentException>(() => builder.Exclude(values));
        }
Beispiel #2
0
        public void ShouldThrowIfNullParameterPassed()
        {
            SetupVerifiableAxeInjectionCall();

            VerifyExceptionThrown <ArgumentNullException>(() => new AxeBuilder(webDriverMock.Object, null));
            VerifyExceptionThrown <ArgumentNullException>(() => new AxeBuilder(null));

            var builder = new AxeBuilder(webDriverMock.Object);

            VerifyExceptionThrown <ArgumentNullException>(() => builder.WithRules(null));
            VerifyExceptionThrown <ArgumentNullException>(() => builder.DisableRules(null));
            VerifyExceptionThrown <ArgumentNullException>(() => builder.WithTags(null));
            VerifyExceptionThrown <ArgumentNullException>(() => builder.Include(null));
            VerifyExceptionThrown <ArgumentNullException>(() => builder.Exclude(null));
            VerifyExceptionThrown <ArgumentNullException>(() => builder.WithOptions(null));
        }
Beispiel #3
0
        public void ShouldThrowIfDeprecatedOptionsIsUsedWithNewOptionsApis()
        {
            SetupVerifiableAxeInjectionCall();

            var builder = new AxeBuilder(webDriverMock.Object);

#pragma warning disable CS0618
            builder.Options = "{xpath:true}";
#pragma warning restore CS0618

            VerifyExceptionThrown <InvalidOperationException>(() => builder.WithRules("rule-1"));
            VerifyExceptionThrown <InvalidOperationException>(() => builder.DisableRules("rule-1"));
            VerifyExceptionThrown <InvalidOperationException>(() => builder.WithTags("tag1"));
            VerifyExceptionThrown <InvalidOperationException>(() => builder.WithOptions(new AxeRunOptions()
            {
                Iframes = true
            }));
        }