Table of Contents

WildcardOptions Class

Definition

Namespace
Codebelt.Extensions.Xunit
Assemblies
Codebelt.Extensions.Xunit.dll
Source
src/Codebelt.Extensions.Xunit/WildcardOptions.cs
public class WildcardOptions
Inheritance
WildcardOptions

Examples

Configure wildcard matching to throw when a value does not match the expected pattern.

using Codebelt.Extensions.Xunit;
using Xunit;

namespace Example.Tests;

public class WildcardExampleTest : Test
{
    public WildcardExampleTest(ITestOutputHelper output) : base(output) { }

    [Fact]
    public void ShouldMatchConfiguredPattern()
    {
        var options = new WildcardOptions { ThrowOnNoMatch = true };
        Assert.True(Match("cache*", "cached", setup => setup.ThrowOnNoMatch = options.ThrowOnNoMatch));
    }
}

Availability: .NET 11, .NET 10 and .NET Standard 2.0

Constructors

Name Description
WildcardOptions()

Initializes a new instance of the WildcardOptions class.

Properties

Name Description
GroupOfCharacters

Gets or sets the symbol used to represents any group of characters, including no character. The default value is \*.

SingleCharacter

Gets or sets the symbol used to represents any single character. The default value is \?.

ThrowOnNoMatch

Gets or sets a value indicating whether a ArgumentOutOfRangeException is thrown when no match is found. The default value is false.