[WIP] Add support for IImmutableDictionary and IReadOnlyDictionary#1132
[WIP] Add support for IImmutableDictionary and IReadOnlyDictionary#1132Evangelink wants to merge 1 commit intofluentassertions:masterfrom
Conversation
|
Is the intention of this PR to cause less breaking changes than #963? This PR remaps So this e.g. breaks MyEnumerable.Should().HaveElementAt(0, myItem); |
|
@jnyrup Sorry about that I opened the PR before leaving on vacations (should have waited to be back). The intent was indeed to provide a less breaking change version than #963 as discussed in the other thread. Regarding the example you are providing this is indeed a breaking change but the impact is probably quite low. I was also thinking that another way to handle this was to keep this implementation and to provide all assertions from WDYT? |
That could work indeed and prevent breaking changes. |
|
I think I quite like this approach as it:
If we further redefine public class GenericCollectionAssertions<T> :
GenericCollectionAssertions<T, GenericCollectionAssertions<T>>
public class GenericCollectionAssertions<T, TAssertions> :
SelfReferencingCollectionAssertions<T, TAssertions>
where TAssetions : GenericCollectionAssertions<T, TAssertions>
|
|
ALright! I'll work on making this change happen then! |
|
@Evangelink Hold your horses. This PR is competing with #963 and I would like to avoid you or @krajek working needlessly on something that will be abandoned. That would be a waste of your valuable contributions. But if it's only fun to implement, go ahead and see where it takes this PR. E.g. if you bump into other problems along the way. |
|
@Evangelink I've chatted with the others and please continue this approach. |
|
Fiddled a bit around with this PR in jnyrup@3cc8bf4
|
What are the pros and cons compared to the other two approaches? |
|
It's a continuation of this PR, so the base idea of extending on Pros:
Cons:
|
Fix #568 and overrides #963
I still need to add some tests for
IImmutableDictionaryandIReadOnlyDictionarybut there are multiple ways I could achieve it and I am not sure which one is best:1/ Add only one test for each type (total new tests = 2).
2/ Add one test per assertion method for each type (total new tests = 2 * number of assertions).
3/ Duplicate the test class for the other 2 interfaces.
4/ (Maybe more complex) Create some helper method that takes a
Dictionary, an actActionand an assertActionand runs them onto theDictionaryas itself, asIDictionary, asIReadOnlyDictionaryand asIImmutableDictionary.Any preference?
@dennisdoomen, @jnyrup