Beispiel #1
0
        public void Build_AddingTheSameDirectiveTwice_OverwritesThePreviousCopy()
        {
            var builder = new FeaturePolicyBuilder();

            builder.AddAccelerometer().Self();
            builder.AddAccelerometer().None();

            var result = builder.Build();

            result.Should().Be("accelerometer 'none'");
        }
Beispiel #2
0
        public void Build_AddAccelerometer_WhenIncludesAllAndNone_ThrowsInvalidOperationException()
        {
            var builder = new FeaturePolicyBuilder();

            builder.AddAccelerometer()
            .None()
            .All();

            Assert.Throws <InvalidOperationException>(() => builder.Build());
        }
Beispiel #3
0
        public void Build_AddAccelerometer_WhenAddsMultipleValue_ReturnsAllValues()
        {
            var builder = new FeaturePolicyBuilder();

            builder.AddAccelerometer()
            .Self()
            .For("http://testUrl.com");

            var result = builder.Build();

            result.Should().Be("accelerometer 'self' http://testUrl.com");
        }
Beispiel #4
0
        public void Build_AddAccelerometer_WhenIncludesAll_OnlyWritesAll()
        {
            var builder = new FeaturePolicyBuilder();

            builder.AddAccelerometer()
            .Self()
            .For("http://testUrl.com")
            .All();

            var result = builder.Build();

            result.Should().Be("accelerometer *");
        }