Esempio n. 1
0
        public void DuplicateSelfAllowed_DuplicatesRemoved()
        {
            //Arrange
            FetchDirectiveBuilder builder = new FetchDirectiveBuilder();

            //Act
            builder.AllowSelf().AllowSelf();

            //Assert
            string result = builder.Build();

            Assert.Equal("'self'", result);
        }
Esempio n. 2
0
        public void NothingElseCalled_SelfReturned()
        {
            //Arrange
            FetchDirectiveBuilder builder = new FetchDirectiveBuilder();

            //Act
            builder.AllowSelf();

            //Assert
            string result = builder.Build();

            Assert.Equal("'self'", result);
        }
        public void SomethingElseCalled_HostsIncluded()
        {
            //Arrange
            FetchDirectiveBuilder builder = new FetchDirectiveBuilder();

            //Act
            builder.AllowSelf();
            builder.AllowHosts("https://example1.com");

            //Assert
            string result = builder.Build();

            Assert.Equal("'self' https://example1.com", result);
        }
        public void SomethingElseCalled_SchemasIncluded()
        {
            //Arrange
            FetchDirectiveBuilder builder = new FetchDirectiveBuilder();

            //Act
            builder.AllowSelf();
            builder.AllowSchemas("blob:");

            //Assert
            string result = builder.Build();

            Assert.Equal("'self' blob:", result);
        }
        public void SomethingElseCalled_OnlyNoneReturned()
        {
            //Arrange
            FetchDirectiveBuilder builder = new FetchDirectiveBuilder();

            //Act
            builder.AllowSelf();
            builder.AllowHosts("https://example1.com", "https://example2.com");
            builder.AllowNone();
            builder.AllowSchemas("blob:");
            builder.AllowAny();

            //Assert
            string result = builder.Build();

            Assert.Equal("'none'", result);
        }