コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }