InlineSnapshotSettings Class
Provides configuration settings for inline snapshot testing.
public sealed class InlineSnapshotSettings : IEquatable<InlineSnapshotSettings>- Implements
Constructors
| Name | Description |
|---|---|
| InlineSnapshotSettings() |
InlineSnapshotSettings()
InlineSnapshotSettings.cspublic InlineSnapshotSettings()No documentation is available.
Properties
| Name | Description |
|---|---|
| AllowedStringFormats | Gets or sets the allowed C# string formats for writing snapshots (quoted, verbatim, raw, etc.). |
| AutoDetectContinuousEnvironment | Gets or sets a value indicating whether to automatically detect continuous integration, continuous testing, and LLM environments and disable snapshot updates. |
| Default | Gets or sets the default settings used for snapshot validation. |
| EndOfLine | Gets or sets the end-of-line string to use when writing snapshots. If null, the end-of-line is detected from the source file. |
| ErrorMessageFormatter | Gets or sets the formatter used to create error messages when snapshots don't match. |
| FileEncoding | Gets or sets the file encoding to use when writing snapshots. If null, the encoding is detected from the source file. |
| ForceUpdateSnapshots | Update snapshots even when the snapshot is already valid. This can be use to reformat snapshots. |
| Indentation | Gets or sets the indentation string to use when writing snapshots. If null, the indentation is detected from the source file. |
| MergeTools | Gets or sets the ordered list of tools used by SnapshotUpdateStrategy.MergeTool and SnapshotUpdateStrategy.MergeToolSync. The first tool that can be started is used. The default list tries the DiffEngine_Tool environment variable, the git merge and diff tools, the current IDE (Visual Studio, Visual Studio Code, Rider), and then the GUI tools detected by DiffEngine. Terminal tools such as Vim are only used when they are named explicitly. If null or empty, no merge tool is launched and the assertion failure is reported. |
| Scrubbers | Gets the list of scrubbers applied to snapshots after serialization. |
| SnapshotComparer | Gets or sets the comparer used to determine if two snapshots are equal. |
| SnapshotSerializer | Gets or sets the serializer used to convert objects to snapshot strings. |
| SnapshotUpdateStrategy | Gets or sets the strategy for updating snapshots when they don't match. |
| ValidateLineNumberUsingPdbInfoWhenAvailable | Before editing a file, use the PDB to validate the line number containing the snapshot. |
| ValidateSourceFilePathUsingPdbInfoWhenAvailable | Before editing a file, use the PDB to validate the file path containing the snapshot. |
AllowedStringFormats
InlineSnapshotSettings.csGets or sets the allowed C# string formats for writing snapshots (quoted, verbatim, raw, etc.).
public CSharpStringFormats AllowedStringFormats { get; set; }Property value
AutoDetectContinuousEnvironment
InlineSnapshotSettings.csGets or sets a value indicating whether to automatically detect continuous integration, continuous testing, and LLM environments and disable snapshot updates.
public bool AutoDetectContinuousEnvironment { get; set; }Property value
Remarks
The default value is true, unless the INLINESNAPSHOTTESTING_AUTODETECT_CONTINUOUS_ENVIRONMENT environment variable is set to false, 0, no or off.
Default
InlineSnapshotSettings.csGets or sets the default settings used for snapshot validation.
public static InlineSnapshotSettings Default { get; set; }Property value
EndOfLine
InlineSnapshotSettings.csErrorMessageFormatter
InlineSnapshotSettings.csGets or sets the formatter used to create error messages when snapshots don't match.
public AssertionMessageFormatter ErrorMessageFormatter { get; set; }Property value
FileEncoding
InlineSnapshotSettings.csForceUpdateSnapshots
InlineSnapshotSettings.csIndentation
InlineSnapshotSettings.csMergeTools
InlineSnapshotSettings.csGets or sets the ordered list of tools used by SnapshotUpdateStrategy.MergeTool and SnapshotUpdateStrategy.MergeToolSync. The first tool that can be started is used. The default list tries the DiffEngine_Tool environment variable, the git merge and diff tools, the current IDE (Visual Studio, Visual Studio Code, Rider), and then the GUI tools detected by DiffEngine. Terminal tools such as Vim are only used when they are named explicitly. If null or empty, no merge tool is launched and the assertion failure is reported.
public IEnumerable<MergeTool>? MergeTools { get; set; }Property value
Remarks
The DiffEngine_Disabled environment variable disables all merge tools, even the ones set explicitly. Merge tools are also never launched on a continuous integration server, in a continuous testing runner, or in an LLM agent while InlineSnapshotSettings.AutoDetectContinuousEnvironment is enabled.
Scrubbers
InlineSnapshotSettings.csGets the list of scrubbers applied to snapshots after serialization.
Property value
SnapshotComparer
InlineSnapshotSettings.csGets or sets the comparer used to determine if two snapshots are equal.
public SnapshotComparer SnapshotComparer { get; set; }Property value
SnapshotSerializer
InlineSnapshotSettings.csGets or sets the serializer used to convert objects to snapshot strings.
public SnapshotSerializer SnapshotSerializer { get; set; }Property value
SnapshotUpdateStrategy
InlineSnapshotSettings.csGets or sets the strategy for updating snapshots when they don't match.
public SnapshotUpdateStrategy SnapshotUpdateStrategy { get; set; }Property value
ValidateLineNumberUsingPdbInfoWhenAvailable
InlineSnapshotSettings.csBefore editing a file, use the PDB to validate the line number containing the snapshot.
public bool ValidateLineNumberUsingPdbInfoWhenAvailable { get; set; }Property value
Remarks
PDB and CallerLineNumberAttribute does not provide the same value. PDB provide the start of the expression whereas the attribute provide the line containing the call to the method. In the case of a multiline expression, the values can differ.
ValidateSourceFilePathUsingPdbInfoWhenAvailable
InlineSnapshotSettings.csMethods
| Name | Description |
|---|---|
| Equals(InlineSnapshotSettings?) | |
| Equals(object?) | |
| GetHashCode() | |
| ToString() |
Equals overloads
Equals(InlineSnapshotSettings?)
public bool Equals(InlineSnapshotSettings? other)No documentation is available.
Equals(object?)
GetHashCode()
ToString()
InlineSnapshotSettings.csOperators
| Name | Description |
|---|---|
| operator ==(InlineSnapshotSettings?, InlineSnapshotSettings?) | |
| operator !=(InlineSnapshotSettings?, InlineSnapshotSettings?) |
operator ==(InlineSnapshotSettings?, InlineSnapshotSettings?)
public static bool operator ==(InlineSnapshotSettings? left, InlineSnapshotSettings? right)No documentation is available.
operator !=(InlineSnapshotSettings?, InlineSnapshotSettings?)
public static bool operator !=(InlineSnapshotSettings? left, InlineSnapshotSettings? right)No documentation is available.