Commit b86b4dc
committed
Fixed error in custom collection mapping test
After assigning `Id`s to all topics in the `StubTopicRepository` (45aa7be), the unit test that validates that associations of associations don't get mapped started failing.
The reason this passed previously is because `IsNew` topics aren't cached by the `TopicMappingService`. As such, while the code does not, correctly, crawl associations of associations, it appears to do so when the topics are saved because the first association points back to the object being mapped—and, thus, when the cached instance of that mapped object is returns, its associations are mapped. This isn't because the mapping service crawled them.
This is resolved by first rearranging the assignment of the `PermittedContentTypes` (the `ContentTypes` relationship) in the `StubTopicRepository` so that both `PermittedContentTypes` themselves have `PermittedContentTypes`, and then setting it to evaluate the second of those relationships, which will not have been cached.
To help further validate this, the test now confirms that the source `Topic` is not set to the mapped `Topic`, and that it does have `PermittedContentTypes` set; this will help avoid false positives in the future.
This resolves #82.1 parent 45aa7be commit b86b4dc
2 files changed
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | 280 | | |
284 | 281 | | |
285 | 282 | | |
286 | 283 | | |
287 | 284 | | |
288 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
680 | 680 | | |
681 | 681 | | |
682 | 682 | | |
683 | | - | |
| 683 | + | |
684 | 684 | | |
685 | 685 | | |
686 | 686 | | |
687 | 687 | | |
688 | 688 | | |
689 | 689 | | |
690 | | - | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
691 | 693 | | |
692 | 694 | | |
693 | 695 | | |
| |||
0 commit comments