public void OnlyOverHttps_SetsAllowOnlyHttpsToTrue()
        {
            var builder = new CspWorkerBuilder();

            builder.OnlyOverHttps();
            CspWorkerSrcOptions options = builder.BuildOptions();

            Assert.True(options.AllowOnlyHttps);
        }
        public void FromAnywhere_SetsAllowAnyToTrue()
        {
            var builder = new CspWorkerBuilder();

            builder.FromAnywhere();
            CspWorkerSrcOptions options = builder.BuildOptions();

            Assert.True(options.AllowAny);
        }
        public void FromSelf_ReturnsCorrectString()
        {
            var builder = new CspWorkerBuilder();

            builder.FromSelf();
            CspWorkerSrcOptions options = builder.BuildOptions();

            Assert.Equal("worker-src 'self'", options.ToString(null));
        }
        public void From_AddsUrlToAllowedSources()
        {
            var builder = new CspWorkerBuilder();

            builder.From("www.google.com");
            CspWorkerSrcOptions options = builder.BuildOptions();

            Assert.Equal("www.google.com", options.AllowedSources.Single());
        }
        public void FromSelf_SetsAllowSelfToTrue()
        {
            var builder = new CspWorkerBuilder();

            builder.FromSelf();
            CspWorkerSrcOptions options = builder.BuildOptions();

            Assert.True(options.AllowSelf);
        }