Awesome
<img src="/src/icon.png" height="30px"> Verify.RavenDB
Extends Verify to allow verification of RavenDB bits.
See Milestones for release notes.
NuGet package
https://nuget.org/packages/Verify.RavenDB/
Enable
Enable VerifyRavenDB once at assembly load time:
<!-- snippet: enable --><a id='snippet-enable'></a>
[ModuleInitializer]
public static void Init() =>
VerifyRavenDB.Initialize();
<sup><a href='/src/Tests/ModuleInit.cs#L3-L9' title='Snippet source file'>snippet source</a> | <a href='#snippet-enable' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->Usage
Verifiying an IDocumentSession will result in all pending changes being written to a snapshot.
Document added
Adding a document to a session:
<!-- snippet: Added --><a id='snippet-Added'></a>
var entity = new Person
{
Name = "John"
};
session.Store(entity);
await Verify(session);
<sup><a href='/src/Tests/Tests.cs#L31-L40' title='Snippet source file'>snippet source</a> | <a href='#snippet-Added' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->Will result in the following verified file:
<!-- snippet: Tests.Added.verified.txt --><a id='snippet-Tests.Added.verified.txt'></a>
[
{
Key: people/1-A,
Changes: [
{
Type: DocumentAdded,
NewValue: {
Name: John
}
}
]
}
]
<sup><a href='/src/Tests/Tests.Added.verified.txt#L1-L13' title='Snippet source file'>snippet source</a> | <a href='#snippet-Tests.Added.verified.txt' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->Document updated
Updating a document in a session:
<!-- snippet: Updated --><a id='snippet-Updated'></a>
var entity = new Person
{
Name = "John"
};
session.Store(entity);
session.SaveChanges();
entity.Name = "Joe";
await Verify(session);
<sup><a href='/src/Tests/Tests.cs#L49-L60' title='Snippet source file'>snippet source</a> | <a href='#snippet-Updated' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->Will result in the following verified file:
<!-- snippet: Tests.Updated.verified.txt --><a id='snippet-Tests.Updated.verified.txt'></a>
[
{
Key: people/1-A,
Changes: [
{
Type: FieldChanged,
FieldName: Name,
NewValue: Joe,
OldValue: John
}
]
}
]
<sup><a href='/src/Tests/Tests.Updated.verified.txt#L1-L13' title='Snippet source file'>snippet source</a> | <a href='#snippet-Tests.Updated.verified.txt' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->Icon
Raven designed by Maciej Świerczek from The Noun Project.