https://github.com/verifytests/verify.nodatime
Adds Verify support for scrubbing NodaTime values.
https://github.com/verifytests/verify.nodatime
Last synced: 11 months ago
JSON representation
Adds Verify support for scrubbing NodaTime values.
- Host: GitHub
- URL: https://github.com/verifytests/verify.nodatime
- Owner: VerifyTests
- License: mit
- Created: 2021-05-03T08:12:59.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-07-21T12:20:07.000Z (11 months ago)
- Last Synced: 2025-07-21T14:25:30.688Z (11 months ago)
- Language: C#
- Homepage:
- Size: 516 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license.txt
Awesome Lists containing this project
README
#
Verify.NodaTime
[](https://github.com/orgs/VerifyTests/discussions)
[](https://ci.appveyor.com/project/SimonCropp/Verify-NodaTime)
[](https://www.nuget.org/packages/Verify.NodaTime/)
Adds [Verify](https://github.com/VerifyTests/Verify) support for scrubbing [NodaTime](https://nodatime.org/) values.
**See [Milestones](../../milestones?state=closed) for release notes.**
## Sponsors
### Entity Framework Extensions
[Entity Framework Extensions](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.NodaTime) is a major sponsor and is proud to contribute to the development this project.
[](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.NodaTime)
## NuGet
* https://nuget.org/packages/Verify.NodaTime
## Usage
```cs
[ModuleInitializer]
public static void Init() =>
VerifyNodaTime.Initialize();
```
snippet source | anchor
Then all Noda date/times will be scrubbed:
```cs
[Fact]
public Task ScrubbingExample()
{
var target = new Person
{
Dob = LocalDateTime.FromDateTime(DateTime.Now)
};
return Verify(target);
}
```
snippet source | anchor
Resulting in:
```txt
{
Dob: LocalDateTime_1
}
```
snippet source | anchor
## Disable scrubbing
To disable scrubbing use `DontScrubNodaTimes`:
```cs
[Fact]
public Task DisableExample()
{
var target = new Person
{
Dob = LocalDateTime.FromDateTime(new(2010, 2, 10))
};
return Verify(target)
.DontScrubNodaTimes();
}
```
snippet source | anchor
Resulting in:
```txt
{
Dob: DateTimeOffset_1
}
```
snippet source | anchor
To disable scrubbing globally use `VerifyNodaTime.DontScrub`:
```cs
[ModuleInitializer]
public static void Init()
{
VerifyNodaTime.DontScrub();
VerifyNodaTime.Initialize();
}
```
snippet source | anchor
## Icon
[Clock](https://thenounproject.com/term/clock/731041/) designed by [Mooyai Khomsun Chaiwong](https://thenounproject.com/mooyai/) from [The Noun Project](https://thenounproject.com/).