An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# Verify.NodaTime

[![Discussions](https://img.shields.io/badge/Verify-Discussions-yellow?svg=true&label=)](https://github.com/orgs/VerifyTests/discussions)
[![Build status](https://ci.appveyor.com/api/projects/status/ej794va900x9257f?svg=true)](https://ci.appveyor.com/project/SimonCropp/Verify-NodaTime)
[![NuGet Status](https://img.shields.io/nuget/v/Verify.NodaTime.svg)](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.

[![Entity Framework Extensions](https://raw.githubusercontent.com/VerifyTests/Verify.NodaTime/refs/heads/main/docs/zzz.png)](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/).