Exemplo n.º 1
0
                public void DefaultValue_ReturnsSelf()
                {
                    var builder = new ContentSecurityPolicyBuilder();

                    Assert.Single(builder.Default);
                    Assert.Equal("'self'", builder.Default.First());
                }
Exemplo n.º 2
0
                public void DefaultValue_Empty()
                {
                    var builder = new ContentSecurityPolicyBuilder();

                    Assert.Single(builder.Object);
                    Assert.Equal("'none'", builder.Object.First());
                }
Exemplo n.º 3
0
        private static ContentSecurityPolicyBuilder Builder(bool clear = true)
        {
            var builder = new ContentSecurityPolicyBuilder();

            if (clear)
            {
                builder.Default.Clear();
                builder.Object.Clear();
            }

            return(builder);
        }
                public void WhenCalled_SetsContentSecurityPolicy()
                {
                    var options = Options();
                    var csp     = new ContentSecurityPolicyBuilder();

                    csp.Default.Clear();
                    csp.Object.Clear();
                    csp.Default.Add("https://example.com");

                    options.Configure(csp);

                    Assert.Equal(csp.ToString(), options.ContentSecurityPolicy);
                }
Exemplo n.º 5
0
                public void DefaultValue_Empty()
                {
                    var builder = new ContentSecurityPolicyBuilder();

                    Assert.Empty(builder.Manifest);
                }
Exemplo n.º 6
0
                public void DefaultValue_ReturnsValue()
                {
                    var value = new ContentSecurityPolicyBuilder().ToString();

                    Assert.Equal("default-src 'self'; object-src 'none'", value);
                }
Exemplo n.º 7
0
                public void DefaultValue_Empty()
                {
                    var builder = new ContentSecurityPolicyBuilder();

                    Assert.Empty(builder.StyleAttr);
                }
Exemplo n.º 8
0
                public void DefaultValue_Empty()
                {
                    var builder = new ContentSecurityPolicyBuilder();

                    Assert.Empty(builder.ScriptElem);
                }