public void VerifyThatExceptionIsNotThrownWhenContainedGroupsTreeIsNormal()
        {
            this.sideEffect =
                new RequirementsGroupSideEffect()
            {
                RequirementsSpecificationService = this.requirementsSpecificationService.Object
            };

            // There is a chain d -> e -> f
            this.rawUpdateInfo = new ClasslessDTO()
            {
                {
                    TestKey,
                    new List <Guid>
                    {
                        this.requirementsGroupB.Iid,
                        this.requirementsGroupD.Iid,
                        this.requirementsGroupC.Iid
                    }
                }
            };

            Assert.DoesNotThrow(
                () => this.sideEffect.BeforeUpdate(
                    this.requirementsGroupA,
                    this.requirementsSpecification,
                    this.npgsqlTransaction,
                    "partition",
                    this.securityContext.Object,
                    this.rawUpdateInfo));
        }
        public void VerifyThatExceptionIsThrownWhenContainedGroupIsGroupItself()
        {
            this.sideEffect =
                new RequirementsGroupSideEffect()
            {
                RequirementsSpecificationService = this.requirementsSpecificationService.Object
            };

            this.rawUpdateInfo = new ClasslessDTO()
            {
                {
                    TestKey,
                    new List <Guid>
                    {
                        this.requirementsGroupA.Iid,
                        this.requirementsGroupC.Iid
                    }
                }
            };

            Assert.Throws <AcyclicValidationException>(
                () => this.sideEffect.BeforeUpdate(
                    this.requirementsGroupA,
                    this.requirementsSpecification,
                    this.npgsqlTransaction,
                    "partition",
                    this.securityContext.Object,
                    this.rawUpdateInfo));
        }
        public void VerifyThatExceptionIsThrownWhenRequirementsGroupLeadsToCircularDependency()
        {
            this.sideEffect =
                new RequirementsGroupSideEffect()
            {
                RequirementsSpecificationService = this.requirementsSpecificationService.Object
            };

            // Leads to circular dependency
            this.rawUpdateInfo = new ClasslessDTO()
            {
                {
                    TestKey,
                    new List <Guid>
                    {
                        this.requirementsGroupB.Iid,
                        this.requirementsGroupD.Iid,
                        this.requirementsGroupF.Iid
                    }
                }
            };

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

            this.rawUpdateInfo = new ClasslessDTO()
            {
                {
                    TestKey,
                    new List <Guid>
                    {
                        this.requirementsGroupB.Iid,
                        this.requirementsGroupD.Iid
                    }
                }
            };

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