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

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.

Awesome Lists containing this project

README

          

# Verify.RavenDB

[![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/3tbsai6lv4d005pg?svg=true)](https://ci.appveyor.com/project/SimonCropp/verify-ravendb)
[![NuGet Status](https://img.shields.io/nuget/v/Verify.RavenDB.svg)](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).