Skip to content
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

State Interceptor Tests #118

Merged
merged 1 commit into from
Feb 5, 2016
Merged

State Interceptor Tests #118

merged 1 commit into from
Feb 5, 2016

Conversation

tonysneed
Copy link
Collaborator

Continuation of #117. I am refactoring tests to use InlineData instead of ClassData, because it is easier to view the test as a specification and because we only need to test branches in ApplyChanges where the interceptors are called or should be called.

@tonysneed
Copy link
Collaborator Author

@luboshl Let me know what you think of how I refactored some of the tests to use InlineData instead of ClassData. The idea is that the tests only cover scenarios which are specific to the test. Hopefully the changes are OK. 😄

@tonysneed
Copy link
Collaborator Author

I found a bug. 🐛 See commit f36fcda. There are places where the interceptors are not being called because TE is not responsible for setting entity state because EF is setting the state automatically. For example, in 1-1 and 1-M relations, TE is not setting the child state when a parent has been set to Added. In this case EF is setting the child state to Added, so TE does not need to set it. However, we will still want to call the interceptors.

@tonysneed
Copy link
Collaborator Author

@luboshl Have a look at this now. I've completed the test refactoring by replacing ClassData with InlineData. If everything is OK, I can squash and merge.

@luboshl
Copy link
Contributor

luboshl commented Feb 4, 2016

Everything ok!

- Allows user to intercept DbContext.ApplyChanges in order to specify the EntityState which should be applied to one or more entities.
- Resolves issue #106.
@luboshl
Copy link
Contributor

luboshl commented Feb 5, 2016

It looks good 👍

@tonysneed tonysneed merged commit 9938cb7 into develop Feb 5, 2016
@tonysneed tonysneed deleted the luboshl-iss106-tests branch February 5, 2016 10:18
@tonysneed
Copy link
Collaborator Author

Thanks @luboshl for all your hard work on this feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants