huysentruitw / entity-framework-core-mock

Easy Mock wrapper for mocking EFCore5 DbContext and DbSet using Moq or NSubstitute
MIT License
132 stars 24 forks source link

Fixing issue #47: DBSetBackingStore.ApplyChanges always returns zero #48

Closed zeynalnia closed 2 years ago

zeynalnia commented 2 years ago

DBSetBackingStore.ApplyChanges uses _changes.Count to return number of changes, _changes is always empty because Interlocked.Exchange(ref _changes, new List<DbSetChange>()) is called before that. suggested fix is to use changes.Count instead. (no underscores)

Link to the issue

huysentruitw commented 2 years ago

Thanks for this PR!