-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add collection .IfAny() .IfSingle() .IfNotSingle() .IfNone() .IfAll() #20
Comments
@mantinband |
I picked up this issue. Currently writing test. |
Awesome, that was quick! Let me know If you have any questions. Also, feel free to split this into multiple PRs if that would be more convenient 🙂 |
@mantinband Im assuming for This however wont yield same results for a collection of strings unless a numeric property or function of the string (Count, Length, etc.) is Invoked |
I was thinking of something similar to this draft PR: #25 There is a C# language limitation that we cannot specify the method declaration as following: public static ref readonly Validatable<TValue> IfAny<TValue, TItem>(this in Validatable<TValue<TItem>> validatable, Func<TItem, bool> predicate, [CallerArgumentExpression("predicate")] string? predicateName = null) Unfortunately in this implementation, we need to disambiguate the predicate's input parameter ( |
@mantinband |
Should these operations be limited to a subset ⊆ of Rational numbers |
Nah, I think the main use case will be on complex objects and not on collections of rational numbers/strings |
I'm going to jump back to working on this issue |
Hi there! Just jumping into the pool. Is the issue still being worked on? Or is it up for grabs? |
Hey @SakuraIsayeki you could definitely look at this issue. |
Okay. I see where the snag lies.To recap, the current issue has us unable to determine Action action = () => collection.Throw().IfAny(x => x == "ho");
Action action2 = () => collection2.Throw().IfAny(x => x == 1); Where Here's what I have so far: SakuraIsayeki@7e87a42 This got me thinking... How did they manage it on FluentAssertions?FluentAssertions would have it as so: collection.Should().Satisfy(x => x == "ho");
collection2.Should().Satisfy(x => x == 1); And it just works. Here's the catch tho ; These buggers used I suspect what's left to do is to somehow hack |
Draft for Issue amantinband#20. The extension method is DOA, due to generics not resolving properly. See: amantinband#20 (comment)
Any update on this? It would be really useful to have this feature. |
Add the following collection validations:
The text was updated successfully, but these errors were encountered: