Skip to content

Adds Verify support for scrubbing NodaTime values.

License

Notifications You must be signed in to change notification settings

VerifyTests/Verify.NodaTime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Verify.NodaTime

Discussions Build status NuGet Status

Adds Verify support for scrubbing NodaTime values.

See Milestones for release notes.

NuGet package

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

Usage

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

snippet source | anchor

Then all Noda date/times will be scrubbed:

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

    return 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(2010, 2, 10))
    };

    return Verify(target)
        .DontScrubNodaTimes();
}

snippet source | anchor

Resulting in:

{
  Dob: DateTimeOffset_1
}

snippet source | anchor

Icon

Clock designed by Mooyai Khomsun Chaiwong from The Noun Project.

About

Adds Verify support for scrubbing NodaTime values.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors 4

  •  
  •  
  •  
  •  

Languages