public void VerifyThatExceptionIsNotThrownWhenCategoryHasRepeatedSuperCategoriesWithoutCircularDependency() { this.sideEffect = new CategorySideEffect() { CategoryService = this.categoryService.Object, SiteReferenceDataLibraryService = this.siteReferenceDataLibraryService.Object }; // There is a chain d -> e -> f and e -> g -> c // category will reference a -> d and -> g which means that it references g twice, but without circular dependency this.rawUpdateInfo = new ClasslessDTO() { { TestKey, new List <Guid> { this.categoryD.Iid, this.categoryG.Iid } } }; Assert.DoesNotThrow( () => this.sideEffect.BeforeUpdate( this.categoryA, this.referenceDataLibraryA, this.npgsqlTransaction, "partition", this.securityContext.Object, this.rawUpdateInfo)); }
public void VerifyThatExceptionIsThrownWhenSuperCategoryIsCategoryItself() { this.sideEffect = new CategorySideEffect() { CategoryService = this.categoryService.Object, SiteReferenceDataLibraryService = this.siteReferenceDataLibraryService.Object }; this.rawUpdateInfo = new ClasslessDTO() { { TestKey, new List <Guid> { this.categoryA.Iid } } }; Assert.Throws <AcyclicValidationException>( () => this.sideEffect.BeforeUpdate( this.categoryA, this.referenceDataLibraryA, this.npgsqlTransaction, "partition", this.securityContext.Object, this.rawUpdateInfo)); }
public void VerifyThatExceptionIsThrownWhenSuperCategoryIsOutOfChainOrLeadsToCircularDependency() { this.sideEffect = new CategorySideEffect() { CategoryService = this.categoryService.Object, SiteReferenceDataLibraryService = this.siteReferenceDataLibraryService.Object }; // Out of chain this.rawUpdateInfo = new ClasslessDTO() { { TestKey, new List <Guid> { this.categoryB.Iid } } }; Assert.Throws <AcyclicValidationException>( () => this.sideEffect.BeforeUpdate( this.categoryA, this.referenceDataLibraryA, this.npgsqlTransaction, "partition", this.securityContext.Object, this.rawUpdateInfo)); // Leads to circular dependency this.rawUpdateInfo = new ClasslessDTO() { { TestKey, new List <Guid> { this.categoryD.Iid } } }; Assert.Throws <AcyclicValidationException>( () => this.sideEffect.BeforeUpdate( this.categoryC, this.referenceDataLibraryA, this.npgsqlTransaction, "partition", this.securityContext.Object, this.rawUpdateInfo)); }