You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge branch 'bugfix/PermittedContentTypes-tests' into develop
To better reflect real-world conditions, the `StubTopicRepository` was set to treat all topics as "saved"—i.e., by assigning them an `Id`. Most of the topics already had an `Id` set, but not the `ContentTypeDescriptors`. This exposed two bugs.
The first bug was simply an issue with the unit test; the `TopicMappingService` cached view models based on their `Topic.Id`, and so `IsNew` topics aren't cached; when these were migrated to "saved" topics, a circular reference in the test case was exposed which failed to adequately test associations of associations (#82).
The second bug fix was due to an underlying problem in the `TopicRepository.Save()`. This test confirmed that the `PermittedContentTypes` were refreshed after a `ContentTypeDescriptor` with updated relationships was saved. The problem is that it evaluated if the relationships were dirty _after_ the topic had been saved—and marked as clean. As such, the relationships should _never_ be dirty. This issue was obscured by the `IsNew` content types because a relationship cannot be marked clean if it still references `IsNew` topics, since in a real-world scenario, only relationships to saved topics can be persisted. This is easily fixed by evaluating the `Topic.Relationships.IsDirty()` state prior to marking the collection as saved. This resolved#81.
0 commit comments