PapGroup / NSubstitute.FluentAssertionsBridge

a library for bridging between NSubstitute and FluentAssertions
MIT License
9 stars 2 forks source link
assertions fluentassertions mocking nsubstitute unit-testing

NSubstitute.FluentAssertionsBridge

a library for bridging between NSubstitute and FluentAssertions in order to verify arguments of called methods using FluentAssertions.

Build

Branch Status
Master Build Status
Develop Build Status

Installation

Source Link
Nuget Nuget Version

Usage

The library provides a static method called 'Verify.That' that takes an 'Action' parameter for passing an assertion. For example, the following code verifies that 'Register' method called with expected object one time :

using PAP.NSubstitute.FluentAssertionsBridge;

...
var service = Substitute.For<IRegistrationService>();
var expected = new RegistrationModel(){ Username = "Admin", Password="123456" };
...
...
service.Received(1).Register(Verify.That<RegistrationModel>(a=> a.Should().BeEquivalentTo(expected)));