public void Setup() { _container = new SecurityTextContainer { Contact = "mailto:[email protected]" }; }
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://\"."); } }
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"); }
public void Returns_Single_Line() { SecurityTextContainer.CreateComment("test", Environment.NewLine).Should().Be("# test"); }
public void Returns_Empty_For_Null_Value() { SecurityTextContainer.CreateComment(null, Environment.NewLine).Should().BeEmpty(); }