public void VerifyThatExceptionIsNotThrownWhenReferenceUnitDoesNotLeadToCircularDependency() { this.sideEffect = new LinearConversionUnitSideEffect { ConversionBasedUnitService = this.conversionBasedUnitService.Object, SiteReferenceDataLibraryService = this.siteReferenceDataLibraryService.Object }; // There is a chain a -> b -> c this.rawUpdateInfo = new ClasslessDTO() { { TestKey, this.linearConversionUnitD.Iid } }; Assert.DoesNotThrow( () => this.sideEffect.BeforeUpdate( this.linearConversionUnitC, this.referenceDataLibraryA, this.npgsqlTransaction, "partition", this.securityContext.Object, this.rawUpdateInfo)); }
public void VerifyThatExceptionIsThrownWhenReferenceUnitIsOutOfChainOrLeadsToCircularDependency() { this.sideEffect = new LinearConversionUnitSideEffect { ConversionBasedUnitService = this.conversionBasedUnitService.Object, SiteReferenceDataLibraryService = this.siteReferenceDataLibraryService.Object }; // Out of chain this.rawUpdateInfo = new ClasslessDTO() { { TestKey, this.linearConversionUnitE.Iid } }; Assert.Throws <AcyclicValidationException>( () => this.sideEffect.BeforeUpdate( this.linearConversionUnitC, this.referenceDataLibraryA, this.npgsqlTransaction, "partition", this.securityContext.Object, this.rawUpdateInfo)); // Leads to circular dependency this.rawUpdateInfo = new ClasslessDTO() { { TestKey, this.linearConversionUnitA.Iid } }; Assert.Throws <AcyclicValidationException>( () => this.sideEffect.BeforeUpdate( this.linearConversionUnitC, this.referenceDataLibraryA, this.npgsqlTransaction, "partition", this.securityContext.Object, this.rawUpdateInfo)); }
public void VerifyThatExceptionIsThrownWhenReferenceIsUnitItself() { this.sideEffect = new LinearConversionUnitSideEffect { ConversionBasedUnitService = this.conversionBasedUnitService.Object, SiteReferenceDataLibraryService = this.siteReferenceDataLibraryService.Object }; this.rawUpdateInfo = new ClasslessDTO() { { TestKey, this.linearConversionUnitA.Iid } }; Assert.Throws <AcyclicValidationException>( () => this.sideEffect.BeforeUpdate( this.linearConversionUnitA, this.referenceDataLibraryA, this.npgsqlTransaction, "partition", this.securityContext.Object, this.rawUpdateInfo)); }