Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

236 Commits
236 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Verify.NUlid

Discussions Build status NuGet Status

Extends Verify to enable scrubbing of Universally Unique Lexicographically Sortable Identifiers via the NUlid package.

See Milestones for release notes.

Sponsors

Entity Framework Extensions

Entity Framework Extensions is a major sponsor and is proud to contribute to the development this project.

Entity Framework Extensions

Developed using JetBrains IDEs

JetBrains logo.

NuGet package

https://nuget.org/packages/Verify.NUlid/

Usage

Call VerifyNUlid.Initialize() once at assembly load time.

[ModuleInitializer]
public static void Init() =>
    VerifyNUlid.Initialize();

snippet source | anchor

ULIDs will then be scrubbed:

[Test]
public Task UlidScrubbing()
{
    var id = Ulid.NewUlid();
    var target = new Person
    {
        Id = id,
        Name = "Sarah",
        Description = $"Sarah ({id})"
    };
    return Verify(target);
}

snippet source | anchor

Result:

{
  Id: Ulid_1,
  Name: Sarah,
  Description: Sarah (Ulid_1)
}

snippet source | anchor

Disabling Scrubbing

To disable scrubbing use DontScrubUlids()

[Test]
public Task DontScrubFluent()
{
    var id = Ulid.Parse("01JGXG0GDGQEP47CBQ65E50HYH");
    var target = new Person
    {
        Id = id,
        Name = "Sarah",
        Description = $"Sarah ({id})"
    };
    return Verify(target)
        .DontScrubUlids();
}

[Test]
public Task DontScrubInstance()
{
    var id = Ulid.Parse("01JGXG0GDGQEP47CBQ65E50HYH");
    var target = new Person
    {
        Id = id,
        Name = "Sarah",
        Description = $"Sarah ({id})"
    };
    var settings = new VerifySettings();
    settings.DontScrubUlids();
    return Verify(target, settings);
}

snippet source | anchor

Result:

{
  Id: 01JGXG0GDGQEP47CBQ65E50HYH,
  Name: Sarah,
  Description: Sarah (01JGXG0GDGQEP47CBQ65E50HYH)
}

snippet source | anchor

About

Extends Verify to enable scrubbing of Universally Unique Lexicographically Sortable Identifiers via the NUlid https://github.com/RobThree/NUlid package

Resources

Code of conduct

Stars

Watchers

Forks

Releases

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.