Beispiel #1
0
        public void VerifyThatExceptionIsThrownWhenContainingGroupIsOutOfChainOrLeadsToCircularDependencyOnCreate()
        {
            this.sideEffect =
                new ParameterGroupSideEffect()
            {
                ParameterGroupService = this.parameterGroupService.Object
            };

            // Out of the store
            var id = this.parameterGroupD.Iid;

            this.parameterGroupA.ContainingGroup = id;

            Assert.Throws <AcyclicValidationException>(
                () => this.sideEffect.BeforeCreate(
                    this.parameterGroupA,
                    this.elementDefinition,
                    this.npgsqlTransaction,
                    "partition",
                    this.securityContext.Object));
            this.parameterGroupA.ContainingGroup = this.parameterGroupB.Iid;

            // Leads to circular dependency
            id = this.parameterGroupA.Iid;
            this.parameterGroupC.ContainingGroup = id;

            Assert.Throws <AcyclicValidationException>(
                () => this.sideEffect.BeforeCreate(
                    this.parameterGroupC,
                    this.elementDefinition,
                    this.npgsqlTransaction,
                    "partition",
                    this.securityContext.Object));
        }
        public void VerifyThatExceptionIsThrownWhenContainingGroupIsOutOfChainOrLeadsToCircularDependencyOnUpdate()
        {
            this.sideEffect =
                new ParameterGroupSideEffect {
                ParameterGroupService = this.parameterGroupService.Object, OrganizationalParticipationResolverService = this.organizationalParticipationResolverService.Object
            };

            // Out of the store
            this.rawUpdateInfo = new ClasslessDTO {
                { TestKey, this.parameterGroupD.Iid }
            };

            Assert.Throws <AcyclicValidationException>(
                () => this.sideEffect.BeforeUpdate(
                    this.parameterGroupA,
                    this.elementDefinition,
                    this.npgsqlTransaction,
                    "partition",
                    this.securityContext.Object,
                    this.rawUpdateInfo));

            // Leads to circular dependency
            this.rawUpdateInfo = new ClasslessDTO {
                { TestKey, this.parameterGroupA.Iid }
            };

            Assert.Throws <AcyclicValidationException>(
                () => this.sideEffect.BeforeUpdate(
                    this.parameterGroupC,
                    this.elementDefinition,
                    this.npgsqlTransaction,
                    "partition",
                    this.securityContext.Object,
                    this.rawUpdateInfo));
        }
        public void VerifyThatExceptionIsThrownWhenContainingGroupIsParameterGroupItselfOnCreate()
        {
            this.sideEffect =
                new ParameterGroupSideEffect {
                ParameterGroupService = this.parameterGroupService.Object, OrganizationalParticipationResolverService = this.organizationalParticipationResolverService.Object
            };

            var id = this.parameterGroupA.Iid;

            this.parameterGroupA.ContainingGroup = id;

            Assert.Throws <AcyclicValidationException>(
                () => this.sideEffect.BeforeCreate(
                    this.parameterGroupA,
                    this.elementDefinition,
                    this.npgsqlTransaction,
                    "partition",
                    this.securityContext.Object));
        }
        public void VerifyThatExceptionIsThrownWhenContainingGroupIsParameterGroupItselfOnUpdate()
        {
            this.sideEffect =
                new ParameterGroupSideEffect {
                ParameterGroupService = this.parameterGroupService.Object, OrganizationalParticipationResolverService = this.organizationalParticipationResolverService.Object
            };

            this.rawUpdateInfo = new ClasslessDTO {
                { TestKey, this.parameterGroupA.Iid }
            };

            Assert.Throws <AcyclicValidationException>(
                () => this.sideEffect.BeforeUpdate(
                    this.parameterGroupA,
                    this.elementDefinition,
                    this.npgsqlTransaction,
                    "partition",
                    this.securityContext.Object,
                    this.rawUpdateInfo));
        }