-
Notifications
You must be signed in to change notification settings - Fork 26
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
Feature/114 comparing two properties #143
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #143 +/- ##
======================================
Coverage 100% 100%
======================================
Files 39 39
Lines 763 805 +42
======================================
+ Hits 763 805 +42
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I don't get the part related to the GetEnsureRules :/ Could you explain it a little bit? According to your question whether we should stick to one/many Ensure, after a while I'd go for many overloads. Let folks decide which selector is fine for which validation.
Ok, I will try to explain this. We cannot do this inside I hope that you understand my explanation. As I said at the beginning this is just an idea. Maybe you will come up with better solution :) |
Now I get this :D So to things I noticed:
I also think that the |
@GooRiOn I'm a bit busy atm. |
Done
Done as well. To do this I had to create new IValitRuleAccessor. Please check if everything is ok. |
@GooRiOn the methods seems fine to me. |
src/Valit/ValitRules.cs
Outdated
@@ -119,23 +129,41 @@ IValitResult IValitRules<TObject>.Validate(Func<IValitRule<TObject>, bool> predi | |||
private IValitResult Validate(IEnumerable<IValitRule<TObject>> rules) | |||
{ | |||
var result = ValitResult.Success; | |||
|
|||
foreach(var rule in rules.ToList()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not something that is changed in this PR, but why is the .ToList()
needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to avoid multiple enumerations
@tdeschryver agree with your statements but I think we should discuss how to simplify this code. I do what I does but it quite complicated and duplicates the code responsible for handling validation. As I mentioned before, the issue is that I can't come up with any better idea now. It just looks to me that we could do this better (and this applies also to my valit rules responsible for handling nested objects and collection where this code is also duplicated). |
Gotya! |
Created an issue for the duplication #150 |
I removed the out argument from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paw3lx could we do some Skype/Hangout call, so you could explain the whole flow to me? I guess I know what happens here, but would be great to confirm that during the call. It'd be way simpler for me to understand the whole thing. Also, I could explain my PR to you as well :)
@GooRiOn Yes, sure. Just contact me and we can do some Skype call :) I think you have my email or snapchat. |
This PR is not resolved for too long. Need to close it :( |
Info
This Pull Request is related to issue no. #114
After the latest problems with develop branch I talked to @GooRiOn. We decided that the best will be to create new PR on this repo instead of my fork.
I will just copy/paste notes from previous PR:
Guys, I added few lines of code to provide possibility to compare two properties. It's just a draft, so please take a look. I was not sure about it so I just added one Ensure method and one test to test if it's working.
I think that now we have two possibilities:
To have many Ensure methods. They can look like in this PR
Replace Ensure methods to have only one way of creating ValitRules. This could be big change I guess. As @GooRiOn said, it could piss off all folks that use Valit.
What do you think?
Changes
Ensure
method to provide functionality of comparing two properties