Skip to content

Fix Exception in list static filter index assumptions#1120

Open
jcummings2 wants to merge 9 commits into
reactivemarbles:mainfrom
jcummings2:fix-removekey-list-static-filter-index-assumptions
Open

Fix Exception in list static filter index assumptions#1120
jcummings2 wants to merge 9 commits into
reactivemarbles:mainfrom
jcummings2:fix-removekey-list-static-filter-index-assumptions

Conversation

@jcummings2

Copy link
Copy Markdown
Contributor

See #1119

Comment thread src/DynamicData.Tests/Cache/RemoveKeyFixture.cs Outdated
_cleanup.Add(
_source.Connect()
.RemoveKey()
.Filter(x => x.Age < average)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the test fixture for "RemoveKey", the only thing that should be getting tested is .RemoveKey(), What you're REALLY trying to test for here is behavior in .Filter(), specifically, .Filter()'s ability to support missing indexes. That belongs in the appropriate "Filter" fixture.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I was actually trying to demonstrate was what series of calls would lead to the error. This test is really just a step indicating it wasn't the problem. Filter() itself is tested more thoroughly in all the Filter* classes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you trying to say you want this test removed?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I'm saying move it over to the Filter fixture. .Filter() is the operator here that has defective behavior. If other operators are capable of generating changesets with missing list indexes, .Filter() needs to be able to process them. At least, that's how you've written the fix. With that being a behavior that .Filter() needs, there should ve a test in the Filter fixture that feeds missing indexes into the operator, and verifies that it works.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are about 7 files making up the Filter fixture. I moved it to FilterFixture.Static.cs

Comment thread src/DynamicData/List/Internal/Filter.Static.cs Outdated
Comment thread src/DynamicData/List/Internal/Filter.Static.cs
@jcummings2

Copy link
Copy Markdown
Contributor Author

I updated test names and removed the extraneous comment per your feedback. Let me know if those names need further tweaking.

I also added another test that moves the RemoveKey() call to just before the bind. This new test passes even with the old code as it turns out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants