Skip to content

Improving testability and intuitivity of hooks #529

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

Merged
merged 12 commits into from
Jun 21, 2019

Conversation

maurei
Copy link
Member

@maurei maurei commented Jun 20, 2019

We found that when implementing resource hooks in our application, it wasn't very easy to unit test them. This was because 1) the resource helpers AffectedRelationships, AffectedResources, and AffectedResourceDiff were hard/impossible to mock/instantiate for unit testing, and because 2) these types don't give an intuitive feeling of the data structure they represent.

This PR fixes this by introducing following changes

  • made the constructors of the affected resource/relationship helper classes public so they can be instantiated
  • these public constructors now have clear dependencies
  • got rid of RelationshipProxy where the use of RelationshipAttribute suffices; this should make it easier to instantiate AffectedRelationships.
  • AffectedRelationships, AffectedResources and AffectedResourceDiff have been renamed to RelationshipsDictionary, EntityHashSet and EntityDiffs to make clear that (for the first two) you're actually just dealing with a dictionary and a hashset.

@maurei maurei changed the title Feat/simplification hooks Improving testability of hooks Jun 20, 2019
@maurei maurei changed the title Improving testability of hooks Improving testability and intuitivity of hooks Jun 20, 2019
@maurei maurei merged commit 8cca15a into master Jun 21, 2019
@maurei maurei deleted the feat/simplification-hooks branch November 11, 2019 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants