コード例 #1
0
        public void Self_SetsSelfSrc()
        {
            var directive = new CspDirective();
            
            directive.Self();

            Assert.IsTrue(directive.SelfSrc);
        }
コード例 #2
0
        public void Self_SetsSelfSrc()
        {
            var directive = new CspDirective();

            directive.Self();

            Assert.True(directive.SelfSrc);
        }
コード例 #3
0
        public void None_DirectiveSourcesConfigured_ThrowsException()
        {
            var directiveSelf = new CspDirective();
            var directiveSources = new CspDirective();
            var directiveUnsafeInline = new CspDirective();
            var directiveUnsafeEval = new CspDirective();
            directiveSelf.Self();
            directiveSources.CustomSources("https:");
            directiveUnsafeInline.UnsafeInline();
            directiveUnsafeEval.UnsafeEval();

            Assert.Throws<InvalidOperationException>(directiveSelf.None);
            Assert.Throws<InvalidOperationException>(directiveSources.None);
            Assert.Throws<InvalidOperationException>(directiveUnsafeInline.None);
            Assert.Throws<InvalidOperationException>(directiveUnsafeEval.None);
        }