public void Build_AddingTheSameDirectiveTwice_OverwritesThePreviousCopy() { var builder = new FeaturePolicyBuilder(); builder.AddAccelerometer().Self(); builder.AddAccelerometer().None(); var result = builder.Build(); result.Should().Be("accelerometer 'none'"); }
public void Build_AddAccelerometer_WhenIncludesAllAndNone_ThrowsInvalidOperationException() { var builder = new FeaturePolicyBuilder(); builder.AddAccelerometer() .None() .All(); Assert.Throws <InvalidOperationException>(() => builder.Build()); }
public void Build_AddAccelerometer_WhenAddsMultipleValue_ReturnsAllValues() { var builder = new FeaturePolicyBuilder(); builder.AddAccelerometer() .Self() .For("http://testUrl.com"); var result = builder.Build(); result.Should().Be("accelerometer 'self' http://testUrl.com"); }
public void Build_AddAccelerometer_WhenIncludesAll_OnlyWritesAll() { var builder = new FeaturePolicyBuilder(); builder.AddAccelerometer() .Self() .For("http://testUrl.com") .All(); var result = builder.Build(); result.Should().Be("accelerometer *"); }