InlineSnapshotAssertionAttribute Class
Marks a method as an inline snapshot assertion method and specifies the parameter that contains the expected snapshot value. This attribute is used to enable snapshot validation in helper methods.
[AttributeUsage(AttributeTargets.Method)]
public sealed class InlineSnapshotAssertionAttribute : AttributeExample
Helper(new { Name = "John" }, "Name: John");
[InlineSnapshotAssertion(nameof(expected))]
static void Helper(object data, string expected, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = -1)
{
InlineSnapshot.Validate(data, expected, filePath, lineNumber);
}- Inheritance
AttributeInlineSnapshotAssertionAttribute
Constructors
| Name | Description |
|---|---|
| InlineSnapshotAssertionAttribute(string) | Initializes a new instance of the InlineSnapshotAssertionAttribute class with the specified parameter name. |
InlineSnapshotAssertionAttribute(string)
InlineSnapshotAssertionAttribute.csInitializes a new instance of the InlineSnapshotAssertionAttribute class with the specified parameter name.
public InlineSnapshotAssertionAttribute(string parameterName)Parameters
parameterNamestring- The name of the parameter that contains the expected snapshot value.
Properties
| Name | Description |
|---|---|
| ParameterName | Gets the name of the parameter that contains the expected snapshot value. |