CSharpFunctionalExtensions icon indicating copy to clipboard operation
CSharpFunctionalExtensions copied to clipboard

Extensions for FluentAssertion

Open MaxShoshin opened this issue 4 years ago • 3 comments

Every time I use this library I need write tests and verify Result or Maybe in these tests.

I'm using FluentAssertion and would like to write assertions in some kind:

result.Should().BeSuccessful()
                .And.Value.Should().Be(expected);

The same idea for BeFailed() extension. For MayBe I suggest extension methods like HaveValue() and HaveNoValue().

May be create additional package like CSharpFunctionalExtensions.FluentAssertions to do not copy/past same extension methods from project to project.

What do you think about it?

I can create PR, but first of all I would like to discuss the idea.

Thank you!

MaxShoshin avatar Feb 17 '21 08:02 MaxShoshin

Actually there is an unofficial package that does exactly that. https://www.nuget.org/packages/FluentAssertions.CSharpFunctionalExtensions/

Spoiler: I've never tried it :)

hankovich avatar Feb 18 '21 14:02 hankovich

Many thanks!

My bad.

Package you suggested cover assertion around Result.

MaxShoshin avatar Feb 18 '21 15:02 MaxShoshin

Huh, I didn't know about that package :) I'll link it in the readme. There's no extensions for Maybe there, though.

vkhorikov avatar Feb 23 '21 01:02 vkhorikov