AutoMapper / AutoMapper.Collection.EFCore

EFCore support for AutoMapper.Collections

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

badly-named & missing Persist_RemoveXXX and Persist_InsertOrUpdateXXX tests

DickBaker opened this issue · comments

  1. existing tests are badly named because they touch existing rows (match by existing ID), so ..
    Persist_Remove_WhenEntityDoesNotExist_ThenTheEntityShouldBeInTheDeletedState should be named
    Persist_Remove_WhenEntityExist_ThenTheEntityShouldBeInTheDeletedState

Persist_Remove_WhenEntityDoesNotExist_ThenTheEntityShouldBeDeleted ->
Persist_Remove_WhenEntityExist_ThenTheEntityShouldBeDeleted

ditto legacy
Persist_RemoveAsync_WhenEntityDoesNotExist_ThenTheEntityShouldBeInTheDeletedState
Persist_RemoveAsync_WhenEntityDoesNotExist_ThenTheEntityShouldBeDeleted

  1. missing (presenting with new Things records with ID=0 to signify non-existent)
    Persist_Remove_WhenEntityDoesNotExist_ThenShouldBeUnchangedState
    Persist_Remove_WhenEntityDoesNotExist_ThenShouldBeNoChange
    Persist_RemoveAsync_WhenEntityDoesNotExist_ThenShouldBeUnchangedState
    Persist_RemoveAsync_WhenEntityDoesNotExist_ThenShouldBeNoChange

  2. missing
    fortunately EF CT ignores cell changes to the same value (i.e. a no-op) without tagging as Updated
    however any future changes could rip-up this happy-path behaviour so we need tests
    Persist_InsertOrUpdate_WhenSameEntity_ThenTheEntityShouldBeInTheUnchangedState
    Persist_InsertOrUpdate_WhenSameEntity_ThenSavedEntityShouldBeSame
    Persist_InsertOrUpdateAsync_WhenSameEntity_ThenTheEntityShouldBeInTheUnchangedState
    Persist_InsertOrUpdateAsync_WhenSameEntity_ThenSavedEntityShouldBeSame

I am working up a PR to fix all the above, so will increase # of tests [stay tuned]
[since each test starts identically the DIFF matching may false-match, but hope you can conquer that!]

Tasteful combined my PR 40 & 41 as PR 42 and Tyler merged into master but this Issue #39 is still open, so I am now manually closing to remove clutter.

I added my comment to Tyler's merge, so I repeat this here in case not otherwise visible FYI.

I raised Issue #39 and PR #40 and #41 included correcting the miss-spelling class "EntityFramworkCoreTestsBase" to "EntityFrameworkCoreTestsBase" (but the GH DIFF engine ruled that a conflict that I couldn't overcome).
Tasteful thoughtfully combined these as PR #42 that Tyler accepted on 15th Sept. [thanks!].

Somewhere along the way my re-spelling attempt got lost, but at least the intended functional changes all got it (hooray), so I'm happy enough. I had expected that the original Issue #39 would have been closed automatically by GH (because duly mentioned on PR #42), but seems not. I will now explicitly close #39 manually. I intend to raise another Issue+PR in coming weeks.

Whilst waiting for these changes to the AutoMapper.Collection.EFCore package, I raised another PR #149 to AutoMapper.Collection but this seems stalled, so I'd appreciate if Collabs could take a look. Thanks.