https://github.com/ronaldbosma/fluentassertions.argumentmatchers.moq
The FluentAssertions.ArgumentMatchers.Moq package provides a simple way to use Moq in combination with FluentAssertions to compare complex objects.
https://github.com/ronaldbosma/fluentassertions.argumentmatchers.moq
fluentassertions moq
Last synced: 27 days ago
JSON representation
The FluentAssertions.ArgumentMatchers.Moq package provides a simple way to use Moq in combination with FluentAssertions to compare complex objects.
- Host: GitHub
- URL: https://github.com/ronaldbosma/fluentassertions.argumentmatchers.moq
- Owner: ronaldbosma
- License: unlicense
- Created: 2019-08-10T11:04:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-12-07T11:18:26.000Z (5 months ago)
- Last Synced: 2025-03-31T04:08:18.010Z (about 1 month ago)
- Topics: fluentassertions, moq
- Language: C#
- Homepage:
- Size: 103 KB
- Stars: 21
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

FluentAssertions.ArgumentMatchers.Moq
===The [FluentAssertions.ArgumentMatchers.Moq NuGet package](https://www.nuget.org/packages/FluentAssertions.ArgumentMatchers.Moq/) provides a simple way to use Moq in combination with FluentAssertions to compare complex objects.
The package has a method called `Its.EquivalentTo`. It can be used in the Setup and Verify stages of a Mock similar to other argument matchers like ` It.IsAny()`. The `actual.Should().BeEquivalentTo(expected)` method is used inside to compare objects. An overload is available so you can pass in configuration to FluentAssertions.
### Examples
```csharp
_mock.Setup(m => m.DoSomething(Its.EquivalentTo(expectedComplexType))).Returns(result);_mock.Verify(m => m.DoSomething(Its.EquivalentTo(expectedComplexType)));
_mock.Verify(m => m.DoSomething(Its.EquivalentTo(
expectedComplexType,
options => options.Excluding(c => c.SomeProperty)
)));
```