示例#1
0
                public void DefaultValue_ReturnsSelf()
                {
                    var builder = new ContentSecurityPolicyBuilder();

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

                    Assert.Single(builder.Object);
                    Assert.Equal("'none'", builder.Object.First());
                }
示例#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);
                }
示例#5
0
                public void DefaultValue_Empty()
                {
                    var builder = new ContentSecurityPolicyBuilder();

                    Assert.Empty(builder.Manifest);
                }
示例#6
0
                public void DefaultValue_ReturnsValue()
                {
                    var value = new ContentSecurityPolicyBuilder().ToString();

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

                    Assert.Empty(builder.StyleAttr);
                }
示例#8
0
                public void DefaultValue_Empty()
                {
                    var builder = new ContentSecurityPolicyBuilder();

                    Assert.Empty(builder.ScriptElem);
                }