Adds Verify support for scrubbing NodaTime values.
Перейти к файлу
Simon Cropp 9d2a597e74
Merge pull request #38 from VerifyTests/dependabot/nuget/src/Verify-11.23.1
Bump Verify from 11.23.0 to 11.23.1 in /src
2021-08-13 09:33:02 +10:00
.github GitHubSync update - main 2021-05-18 19:03:23 +10:00
src Bump Verify from 11.23.0 to 11.23.1 in /src 2021-08-12 23:19:32 +00:00
.gitignore init 2021-05-05 22:29:07 +10:00
license.txt init 2021-05-05 22:29:07 +10:00
readme.md init 2021-05-05 22:29:07 +10:00

readme.md

Verify.NodaTime

Build status NuGet Status

Adds Verify support for scrubbing NodaTime values.

NuGet package

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

Usage

Before any tests have run call:

VerifyNodaTime.Enable();

Then all Noda date/times will be scrubbed:

[Fact]
public Task ScrubbingExample()
{
    var target = new Person
    {
        Dob = LocalDateTime.FromDateTime(DateTime.Now)
    };

    return Verifier.Verify(target);
}

snippet source | anchor

Resulting in:

{
  Dob: LocalDateTime_1
}

snippet source | anchor

To disable scrubbing use DontScrubNodaTimes:

[Fact]
public Task DisableExample()
{
    var target = new Person
    {
        Dob = LocalDateTime.FromDateTime(new DateTime(2010, 2, 10))
    };

    return Verifier.Verify(target)
        .DontScrubNodaTimes();
}

snippet source | anchor

Resulting in:

{
  Dob: 2010-02-10T00:00:00
}

snippet source | anchor

Icon

Clock designed by Mooyai Khomsun Chaiwong from The Noun Project.