Extends Verify to enable scrubbing of Universally Unique Lexicographically Sortable Identifiers via the NUlid package.
See Milestones for release notes.
https://nuget.org/packages/Verify.NUlid/
Call VerifyNUlid.Initialize()
once at assembly load time.
[ModuleInitializer]
public static void Init() =>
VerifyNUlid.Initialize();
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);
}
Result:
{
Id: Ulid_1,
Name: Sarah,
Description: Sarah (Ulid_1)
}
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);
}
Result:
{
Id: 01JGXG0GDGQEP47CBQ65E50HYH,
Name: Sarah,
Description: Sarah (01JGXG0GDGQEP47CBQ65E50HYH)
}