-
Notifications
You must be signed in to change notification settings - Fork 21
Beginnings of #25. #39
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
Conversation
When you say funky results what do you mean? From what I can tell from the build failures it looks ok (the strings being asserted against just need to be changed?). |
(Sorry for the miscommunication.) Well it prints More importantly, there is no telling what the error message might look like if the predicate involves compiler generated code (as is the case when you capture an outer variable). Consider evaluating the I want to avoid exception messages like this one:
|
Ahh I see. Darn. Looks like we do need something a bit fancier. As a starting point we could look at how Shouldly does it: https://github.com/shouldly/shouldly/blob/e47f958a20b1fb247e262bb503683cc21f80c13a/src/Shouldly/Internals/StringHelpers.cs#L28 |
😢 Maybe I am being thick but I do not see the relationship between what we need here and what Shouldy does. Could you elucidate? I have been doing some research and the only robust solution I can find is this one. It would need tailoring for our needs and I am happy to do that. Thoughts? |
With that It probably won't be as fancy as the one you linked to, but it might do the job given we aren't expecting people to use really complex lambdas. Either way, whatever you decide to introduce I think should be in a sub-namespace (maybe |
I think the |
I am having some trouble approaching this using TDD. I would really love your input. I want to build a class called The trouble is there are so many conditions to test for. For instance, I need to test a bunch of binary operators: Do you have any insight as to how to approach this in a clean way? Personally I find naming tests like this to be difficult. Could you please list a few example test names that meet the test naming convention? Thanks so much man. |
I'd identify a list of predicates that we want to support and then pop each of them into a test. So I think the following are probably good enough to start - we can add others later if we or other people notice them and report it:
Each test might look something like:
Only other thing I'm thinking is whether we should get the inspector to put in the values of the properties in there somehow as well to make the statement even more useful for debugging... One other thing to think about is whether we even care about the |
Thank you man. I am going to have a stab at this tonight. |
Sorry my lackadaisical response earlier, I had only just woken up.
We spoke about this previously and I concur, we absolutely should. I am going to focus on inflecting the expression tree first though.
I completely see where you are coming from and I think what you suggest is the conceptually sound thing to do. I know that using |
I'm happy for you to run with whichever option suits you :)
|
Btw Have you watched Ian coopers TDD Where did it go wrong talk?
|
Yes I watched it a couple of months ago. Honestly, back then it went over my head. I should watch it again now I have some more experience. Is there a particular part of the recording I should watch that is relevant to this PR do you think? |
Just his general assertion about testing from the public API rather than implementation detail
|
I do not think it will be possible to remove the extraneous parentheses that surround expressions because it is too difficult to differentiate said extraneous parentheses from meaningful ones.
Should I roll with this? I really do not think the ideal output (i.e. one with no extraneous parentheses) will be attainable without writing a considerably complicated parser (even using the |
It looks great mate. Ship it :) we can always improve if in the future if needed.
|
Originally I had intended to remove any extraneous parentheses such as those that surround language expressions. Unfortunately, this proved to be more difficult than I had anticipated as it is hard to differentiate said extraneous parentheses from meaningful ones such as those used to invoke a method. It is for these reasons that I have changed the test specification to allow extraneous parentheses.
What you are looking at here is probably the simplest possible passable implementation. There are some limitations but those limitations are not likely to to be prevalent imo. I intend for the tests to serve as regression tests when I implement something like this in the (hopefully-near) future. I suspect this implementation is pretty robust because it is mostly predicated on vendor code (like |
There is a discrepancy with the I was hoping you could take a look at it and then advise? Thanks in advance. |
Bump. |
Taking a look now |
Add the following to [assembly: InternalsVisibleTo("TestStack.FluentMVCTesting.Mvc3.Tests")]
[assembly: InternalsVisibleTo("TestStack.FluentMVCTesting.Mvc4.Tests")] |
Thanks. Implemented 👍 |
Hey man. I hope you get time to review this soon 👍 |
Sorry mate - thought you were going to merge it since I already looked. My bad. |
Note that this PR is intended to fail.
While working on #25 I discovered that inflecting an expression is not quite as straightforward as I had hoped. It turns out that calling
ToString
on an expression produces some funky results. I added some failing tests (hence the failing build) to demonstrate the problem.I have done some preliminary research, but I cannot find anything of use.
Any thoughts on how to overcome this obstacle?