danielwertheim / Ensure.That

Guard clause project for .NET
MIT License
439 stars 49 forks source link

Chaining clauses #177

Open figueiredorj opened 2 years ago

figueiredorj commented 2 years ago

hi @danielwertheim , the concept is very good and did already kne it.. just did not tried to look for or developed one my self...

When I saw you have chaining in this it was top... however seems to lack support for properly chaining.. returning void or string or else does not make any sense.. please make all entities return type of Param.

If you need help with this extra work let me know.. I wouldn't mind helping you making this more usable :)

ndrwrbgs commented 1 year ago

It looks like it’s chainable per the documentation: https://github.com/danielwertheim/Ensure.That

Could you include a code snippet you’d expect would work which does not?

figueiredorj commented 1 year ago

sorry... meanwhile at work didn't noticed this.... now don't remember the use case I was facing...

eNTi commented 1 year ago

I'd like to know this too. How is this supposed to work?

erzki commented 9 months ago

The simple example that is presented in the documentation doesn't work from version 6+. It was working in version 5.

Ensure
  .That(myString)
  .IsNotNullOrWhiteSpace()
  .IsGuid();

The problem is that IsNotNullOrWhiteSpace is void and doesn't return a Param.

This is a bit of a deal breaker for us actually because we do a lot of chaining with Ensure.That.

erzki commented 9 months ago

@danielwertheim I see in the source code that it actually returns StringParam to make it chainable but not in the latest version on nuget. Do you have any plans to release a new version?

ndrwrbgs commented 8 months ago

@erzki it looks like https://www.nuget.org/packages/Ensure.That/11.0.0-p3 was published after the change was made and is on nuget, could you try that version?