Exemple #1
0
 public void Setup()
 {
     _container = new SecurityTextContainer
     {
         Contact = "mailto:[email protected]"
     };
 }
Exemple #2
0
    private static void ValidateUri(string value, string fieldName, params string[] uriSchemeRestriction)
    {
        if (!IsValidUri(value, uriSchemeRestriction))
        {
            throw new InvalidSecurityInformationException($"The value '{value}' for the {fieldName} field is not a valid uri!");
        }

        if (value.StartsWith("http", StringComparison.OrdinalIgnoreCase) && !SecurityTextContainer.IsValidUrl(value, UriValidationOptions.RequiresSecureScheme))
        {
            throw new InvalidSecurityInformationException($"The value '{value}' for the {fieldName} field is not a valid url! It must be begin with \"https://\".");
        }
    }
Exemple #3
0
 public void Returns_Multiline_With_Prefix_With_Mixed_NewLine_Style()
 {
     SecurityTextContainer.CreateComment("test\r\nother line\nanother line", Environment.NewLine).Should().Be("# test\r\n# other line\r\n# another line");
 }
Exemple #4
0
 public void Returns_Single_Line()
 {
     SecurityTextContainer.CreateComment("test", Environment.NewLine).Should().Be("# test");
 }
Exemple #5
0
 public void Returns_Empty_For_Null_Value()
 {
     SecurityTextContainer.CreateComment(null, Environment.NewLine).Should().BeEmpty();
 }