Skip to content

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.

3 participants