-
Notifications
You must be signed in to change notification settings - Fork 29
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
SameAs in ShouldFluent doesn't work without cast on classes that implement IEnumerable<KeyValuePair> #1
Comments
I'm a little rusty on .NET so I might not remember correctly. SameAs means two variables point to the same instance of a reference typed object. Is it meaningful/useful to ask if one IEnumerable is the same as another (as opposed to individual members)? |
Sure it is -- whatever implements
Just because the object under test implements an interface doesn't mean the usual assertions shouldn't be valid on it. |
I see. Yes, it does tell you something, but nothing too valuable You're verifying that your code does not simply make an assignment and call it a copy. We didn't make every possible assertion available to every type. I personally would not write that test, but that's a matter of opinion. If you prefer not to cast to an object, we'd be happy to take a pull request. Should be pretty simple to add. |
VS2017 & netstandard1.6 support from @eloekset
If you have something like:
and you write a test like:
you won't be able to get to
SameAs()
. I haven't drilled all the way down to find out why, but it looks like it starts withShould()
returningShouldDictionary
. You can work around it by castingfoo2
toObject
, but it's a little awkward.(Great library overall, though!)
The text was updated successfully, but these errors were encountered: