Mongo Extensions

Mongo Extensions

  • Docs
  • Examples
  • Blog
  • GitHub
Project Logo

Mongo Extensions

Common Extensions for MongoDB driver in .Net
Get Started
Learn More

Mongo Extensions

At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.


// arrange
var serviceClient = new ServiceClient();

// act
TestPerson person = serviceClient.CreatePerson(...);

// assert
Assert.IsEqual(person.Firstname, "David");
Assert.IsEqual(person.Lastname, "Smith");
Assert.IsEqual(person.Age, 30);
Assert.IsEqual(person.Size, 182.5214);
Assert.IsEqual(person.CreationDate, DateTime.Parse(...));
Assert.IsEqual(person.DateOfBirth, DateTime.Parse(...));

Reduce your asserts in your test

Instead of writing multiple asserts within your test assert section, just reduce it to one assert.

Sometimes we receive a test result object with several properties, and all of them have to be checked... Now instead of writing for each property an assert, just validate all properties at once with a snapshot.


// arrange
var serviceClient = new ServiceClient();

// act
TestPerson person = serviceClient.CreatePerson(...);

// assert
Snapshot.Match(person);






Get started in seconds

With Snapshooter you need just two commands to get a snapshot test validation running in your test project.

Install the snapshooter nuget package within your test project:

dotnet add package Snapshooter.Xunit

Assert the result in your test with the Snapshot.Match command:

[Fact]
public void CreatePerson_VerifyPersonBySnapshot_SuccessfulVerified()
{
    // arrange
    var serviceClient = new ServiceClient();

    // act
    TestPerson person = serviceClient.CreatePerson(
        Guid.Parse("2292F21C-8501-4771-A070-C79C7C7EF451"), "David", "Mustermann");

    // assert
    Snapshot.Match(person);
}

Community

Contributor License AgreementsCode of Conduct
Swiss Life OSSSwiss Life | OSS
Copyright © 2020 Swiss Life Developer