AttributeTargets.Event, Inherited = false)]
public sealed class RequiresPreviewFeaturesAttribute : Attribute
{
+ /// <summary>
+ /// Initializes a new instance of the <seealso cref="RequiresPreviewFeaturesAttribute"/> class.
+ /// </summary>
public RequiresPreviewFeaturesAttribute() { }
+
+ /// <summary>
+ /// Initializes a new instance of the <seealso cref="RequiresPreviewFeaturesAttribute"/> class with the specified message.
+ /// </summary>
+ /// <param name="message">An optional message associated with this attribute instance.</param>
+ public RequiresPreviewFeaturesAttribute(string? message)
+ {
+ Message = message;
+ }
+
+ /// <summary>
+ /// Returns the optional message associated with this attribute instance.
+ /// </summary>
+ public string? Message { get; }
+
+ /// <summary>
+ /// Returns the optional URL associated with this attribute instance.
+ /// </summary>
+ public string? Url { get; set; }
}
}
public sealed partial class RequiresPreviewFeaturesAttribute : System.Attribute
{
public RequiresPreviewFeaturesAttribute() { }
+ public RequiresPreviewFeaturesAttribute(string? message) { }
+ public string? Message { get { throw null; } }
+ public string? Url { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false)]
[System.Diagnostics.ConditionalAttribute("RESOURCE_ANNOTATION_WORK")]
{
new RequiresPreviewFeaturesAttribute();
}
+
+ [Fact]
+ public static void Ctor_Default()
+ {
+ var attribute = new RequiresPreviewFeaturesAttribute();
+ Assert.Null(attribute.Message);
+ Assert.Null(attribute.Url);
+ }
+
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ [InlineData("message")]
+ public void Ctor_String_Message(string message)
+ {
+ var attribute = new RequiresPreviewFeaturesAttribute(message);
+ Assert.Same(message, attribute.Message);
+ Assert.Null(attribute.Url);
+ }
+
+ [Theory]
+ [InlineData(null, "")]
+ [InlineData("", null)]
+ [InlineData("message", "https://aka.ms/preview-features/")]
+ public void Ctor_String_Url(string message, string url)
+ {
+ var attribute = new RequiresPreviewFeaturesAttribute(message) { Url = url };
+ Assert.Same(message, attribute.Message);
+ Assert.Same(url, attribute.Url);
+ }
}
}