https://github.com/verifytests/verify.ravendb
Extends Verify to allow verification of RavenDB bits.
https://github.com/verifytests/verify.ravendb
ravendb snapshot-testing verify
Last synced: 11 months ago
JSON representation
Extends Verify to allow verification of RavenDB bits.
- Host: GitHub
- URL: https://github.com/verifytests/verify.ravendb
- Owner: VerifyTests
- License: mit
- Created: 2020-10-17T06:39:45.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-30T01:38:35.000Z (over 1 year ago)
- Last Synced: 2024-05-01T09:37:55.852Z (over 1 year ago)
- Topics: ravendb, snapshot-testing, verify
- Language: C#
- Homepage:
- Size: 469 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license.txt
- Code of conduct: code_of_conduct.md
Awesome Lists containing this project
README
#
Verify.RavenDB
[](https://github.com/orgs/VerifyTests/discussions)
[](https://ci.appveyor.com/project/SimonCropp/verify-ravendb)
[](https://www.nuget.org/packages/Verify.RavenDB/)
Extends [Verify](https://github.com/VerifyTests/Verify) to allow verification of [RavenDB](https://ravendb.net/) bits.
**See [Milestones](../../milestones?state=closed) for release notes.**
## NuGet package
https://nuget.org/packages/Verify.RavenDB/
## Enable
Enable VerifyRavenDB once at assembly load time:
```cs
[ModuleInitializer]
public static void Init() =>
VerifyRavenDB.Initialize();
```
snippet source | anchor
## Usage
Verifiying an [IDocumentSession](https://ravendb.net/docs/article-page/5.0/Csharp/client-api/session/what-is-a-session-and-how-does-it-work) will result in all pending changes being written to a snapshot.
### Document added
Adding a document to a session:
```cs
var entity = new Person
{
Name = "John"
};
session.Store(entity);
await Verify(session);
```
snippet source | anchor
Will result in the following verified file:
```txt
[
{
Key: people/1-A,
Changes: [
{
Type: DocumentAdded,
NewValue: {
Name: John
}
}
]
}
]
```
snippet source | anchor
### Document updated
Updating a document in a session:
```cs
var entity = new Person
{
Name = "John"
};
session.Store(entity);
session.SaveChanges();
entity.Name = "Joe";
await Verify(session);
```
snippet source | anchor
Will result in the following verified file:
```txt
[
{
Key: people/1-A,
Changes: [
{
Type: FieldChanged,
FieldName: Name,
NewValue: Joe,
OldValue: John
}
]
}
]
```
snippet source | anchor
## Icon
[Raven](https://thenounproject.com/term/raven/2011311/) designed by [Maciej Świerczek](https://thenounproject.com/swierq/) from [The Noun Project](https://thenounproject.com).