示例#1
0
        /// <summary>
        /// Read the <see cref="CalculationGroupEntity"/> and use the information to construct
        /// a <see cref="CalculationGroup"/>.
        /// </summary>
        /// <param name="entity">The <see cref="CalculationGroupEntity"/> to create
        /// <see cref="CalculationGroup"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="CalculationGroup"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="collector"/> is <c>null</c>.</exception>
        internal static CalculationGroup ReadAsMacroStabilityInwardsCalculationGroup(this CalculationGroupEntity entity,
                                                                                     ReadConversionCollector collector)
        {
            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            var group = new CalculationGroup
            {
                Name = entity.Name
            };

            foreach (object childEntity in GetChildEntitiesInOrder(entity))
            {
                if (childEntity is CalculationGroupEntity childCalculationGroupEntity)
                {
                    group.Children.Add(childCalculationGroupEntity.ReadAsMacroStabilityInwardsCalculationGroup(collector));
                }

                if (childEntity is MacroStabilityInwardsCalculationEntity childCalculationEntity)
                {
                    group.Children.Add(childCalculationEntity.Read(collector));
                }
            }

            return(group);
        }
示例#2
0
        public void Create_GroupWithChildClosingStructuresCalculationsAndChildCalculationGroups_CreateEntities()
        {
            // Setup
            var group = new CalculationGroup
            {
                Children =
                {
                    new CalculationGroup
                    {
                        Name = "A"
                    },
                    new StructuresCalculationScenario <ClosingStructuresInput>
                    {
                        Name = "B"
                    },
                    new CalculationGroup
                    {
                        Name = "C"
                    },
                    new StructuresCalculationScenario <ClosingStructuresInput>
                    {
                        Name = "D"
                    }
                }
            };

            var registry = new PersistenceRegistry();

            // Call
            CalculationGroupEntity entity = group.Create(registry, 0);

            // Assert
            CalculationGroupEntity[]             childGroupEntities       = entity.CalculationGroupEntity1.ToArray();
            ClosingStructuresCalculationEntity[] childCalculationEntities = entity.ClosingStructuresCalculationEntities.ToArray();
            Assert.AreEqual(2, childGroupEntities.Length);
            Assert.AreEqual(2, childCalculationEntities.Length);

            CalculationGroupEntity childEntity1 = childGroupEntities[0];

            Assert.AreEqual("A", childEntity1.Name);
            Assert.AreEqual(0, childEntity1.Order);
            CollectionAssert.IsEmpty(childEntity1.CalculationGroupEntity1);

            ClosingStructuresCalculationEntity childEntity2 = childCalculationEntities[0];

            Assert.AreEqual("B", childEntity2.Name);
            Assert.AreEqual(1, childEntity2.Order);

            CalculationGroupEntity childEntity3 = childGroupEntities[1];

            Assert.AreEqual("C", childEntity3.Name);
            Assert.AreEqual(2, childEntity3.Order);
            CollectionAssert.IsEmpty(childEntity3.CalculationGroupEntity1);

            ClosingStructuresCalculationEntity childEntity4 = childCalculationEntities[1];

            Assert.AreEqual("D", childEntity4.Name);
            Assert.AreEqual(3, childEntity4.Order);
        }
示例#3
0
        public void Create_WithCalculationGroup_ReturnFailureMechanismEntityWithCalculationGroupEntities()
        {
            // Setup
            var calculationGroup = new CalculationGroup();
            var semiProbabilisticPipingCalculationScenario = new SemiProbabilisticPipingCalculationScenario();
            var probabilisticPipingCalculationScenario     = new ProbabilisticPipingCalculationScenario();

            var failureMechanism = new PipingFailureMechanism();

            failureMechanism.CalculationsGroup.Children.Add(calculationGroup);
            failureMechanism.CalculationsGroup.Children.Add(semiProbabilisticPipingCalculationScenario);
            failureMechanism.CalculationsGroup.Children.Add(probabilisticPipingCalculationScenario);

            // Call
            FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreEqual(failureMechanism.CalculationsGroup.Name, entity.CalculationGroupEntity.Name);
            Assert.AreEqual(0, entity.CalculationGroupEntity.Order);

            CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity.CalculationGroupEntity1
                                                          .OrderBy(cge => cge.Order)
                                                          .ToArray();
            Assert.AreEqual(1, childGroupEntities.Length);
            CalculationGroupEntity childGroupEntity = childGroupEntities[0];

            Assert.AreEqual(calculationGroup.Name, childGroupEntity.Name);
            Assert.AreEqual(0, childGroupEntity.Order);

            SemiProbabilisticPipingCalculationEntity[] semiProbabilisticPipingCalculationEntities = entity.CalculationGroupEntity
                                                                                                    .SemiProbabilisticPipingCalculationEntities
                                                                                                    .OrderBy(ce => ce.Order)
                                                                                                    .ToArray();
            Assert.AreEqual(1, semiProbabilisticPipingCalculationEntities.Length);
            SemiProbabilisticPipingCalculationEntity semiProbabilisticPipingCalculationEntity = semiProbabilisticPipingCalculationEntities[0];

            Assert.AreEqual(semiProbabilisticPipingCalculationScenario.Name, semiProbabilisticPipingCalculationEntity.Name);
            Assert.AreEqual(1, semiProbabilisticPipingCalculationEntity.Order);

            ProbabilisticPipingCalculationEntity[] probabilisticPipingCalculationEntities = entity.CalculationGroupEntity
                                                                                            .ProbabilisticPipingCalculationEntities
                                                                                            .OrderBy(ce => ce.Order)
                                                                                            .ToArray();
            Assert.AreEqual(1, probabilisticPipingCalculationEntities.Length);
            ProbabilisticPipingCalculationEntity probabilisticPipingCalculationEntity = probabilisticPipingCalculationEntities[0];

            Assert.AreEqual(probabilisticPipingCalculationScenario.Name, probabilisticPipingCalculationEntity.Name);
            Assert.AreEqual(2, probabilisticPipingCalculationEntity.Order);
        }
示例#4
0
        /// <summary>
        /// Creates a <see cref="CalculationGroupEntity"/> based on the information of the <see cref="CalculationGroup"/>.
        /// </summary>
        /// <param name="group">The calculation group to create a database entity for.</param>
        /// <param name="registry">The object keeping track of create operations.</param>
        /// <param name="order">The index at which <paramref name="group"/> resides within its parent.</param>
        /// <returns>A new <see cref="CalculationGroupEntity"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="registry"/> is <c>null</c>.</exception>
        internal static CalculationGroupEntity Create(this CalculationGroup group, PersistenceRegistry registry, int order)
        {
            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

            var entity = new CalculationGroupEntity
            {
                Name  = group.Name.DeepClone(),
                Order = order
            };

            CreateChildElements(group, entity, registry);

            return(entity);
        }
示例#5
0
        public void Create_WithCalculationGroup_ReturnFailureMechanismEntityWithCalculationGroupEntities()
        {
            // Setup
            StructuresCalculationScenario <ClosingStructuresInput> calculation = new TestClosingStructuresCalculationScenario();

            calculation.InputParameters.Structure = null;
            calculation.InputParameters.HydraulicBoundaryLocation = null;

            var failureMechanism = new ClosingStructuresFailureMechanism();

            failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup
            {
                Name = "A"
            });
            failureMechanism.CalculationsGroup.Children.Add(calculation);

            var registry = new PersistenceRegistry();

            // Call
            FailureMechanismEntity entity = failureMechanism.Create(registry);

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreEqual(failureMechanism.CalculationsGroup.Name, entity.CalculationGroupEntity.Name);
            Assert.AreEqual(0, entity.CalculationGroupEntity.Order);

            CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity.CalculationGroupEntity1
                                                          .OrderBy(cge => cge.Order)
                                                          .ToArray();
            Assert.AreEqual(1, childGroupEntities.Length);
            CalculationGroupEntity childGroupEntity = childGroupEntities[0];

            Assert.AreEqual("A", childGroupEntity.Name);
            Assert.AreEqual(0, childGroupEntity.Order);

            ClosingStructuresCalculationEntity[] calculationEntities = entity.CalculationGroupEntity.ClosingStructuresCalculationEntities
                                                                       .OrderBy(ce => ce.Order)
                                                                       .ToArray();
            ClosingStructuresCalculationEntity calculationEntity = calculationEntities[0];

            Assert.AreEqual("Nieuwe berekening", calculationEntity.Name);
            Assert.AreEqual(1, calculationEntity.Order);
        }
示例#6
0
        public void Create_StringPropertiesDoNotShareReference()
        {
            // Setup
            const string name  = "original";
            var          group = new CalculationGroup
            {
                Name = name
            };

            var registry = new PersistenceRegistry();

            // Call
            CalculationGroupEntity entity = group.Create(registry, 0);

            // Assert
            Assert.AreNotSame(name, entity.Name,
                              "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
            Assert.AreEqual(name, entity.Name);
        }
示例#7
0
        public void Create_GroupWithoutChildren_CreateEntity(int order)
        {
            // Setup
            const string name  = "blaballab";
            var          group = new CalculationGroup
            {
                Name = name
            };

            var registry = new PersistenceRegistry();

            // Call
            CalculationGroupEntity entity = group.Create(registry, order);

            // Assert
            Assert.AreEqual(name, entity.Name);
            Assert.AreEqual(order, entity.Order);

            CollectionAssert.IsEmpty(entity.CalculationGroupEntity1);
            CollectionAssert.IsEmpty(entity.FailureMechanismEntities);
            Assert.IsNull(entity.CalculationGroupEntity2);
        }
        public void Create_WithCalculationGroup_ReturnFailureMechanismWithCalculationGroupEntities()
        {
            // Setup
            var calculationGroup = new CalculationGroup();
            var calculation      = new MacroStabilityInwardsCalculationScenario();

            var failureMechanism = new MacroStabilityInwardsFailureMechanism();

            failureMechanism.CalculationsGroup.Children.Add(calculationGroup);
            failureMechanism.CalculationsGroup.Children.Add(calculation);

            // Call
            FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreEqual(failureMechanism.CalculationsGroup.Name, entity.CalculationGroupEntity.Name);
            Assert.AreEqual(0, entity.CalculationGroupEntity.Order);

            CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity.CalculationGroupEntity1
                                                          .OrderBy(cge => cge.Order)
                                                          .ToArray();
            Assert.AreEqual(1, childGroupEntities.Length);
            CalculationGroupEntity childGroupEntity = childGroupEntities[0];

            Assert.AreEqual(calculationGroup.Name, childGroupEntity.Name);
            Assert.AreEqual(0, childGroupEntity.Order);

            MacroStabilityInwardsCalculationEntity[] calculationEntities = entity.CalculationGroupEntity.MacroStabilityInwardsCalculationEntities
                                                                           .OrderBy(ce => ce.Order)
                                                                           .ToArray();
            Assert.AreEqual(1, calculationEntities.Length);
            MacroStabilityInwardsCalculationEntity calculationEntity = calculationEntities[0];

            Assert.AreEqual(calculation.Name, calculationEntity.Name);
            Assert.AreEqual(1, calculationEntity.Order);
        }
示例#9
0
        public void Create_GroupWithMacroStabilityInwardsCalculations_CreatesEntities()
        {
            // Setup
            var group = new CalculationGroup
            {
                Children =
                {
                    new MacroStabilityInwardsCalculationScenario
                    {
                        Name = "A"
                    },
                    new MacroStabilityInwardsCalculationScenario
                    {
                        Name = "B"
                    }
                }
            };

            var registry = new PersistenceRegistry();

            // Call
            CalculationGroupEntity entity = group.Create(registry, 0);

            // Assert
            MacroStabilityInwardsCalculationEntity[] childCalculationEntities = entity.MacroStabilityInwardsCalculationEntities.ToArray();
            Assert.AreEqual(2, childCalculationEntities.Length);

            MacroStabilityInwardsCalculationEntity childEntity1 = childCalculationEntities[0];

            Assert.AreEqual("A", childEntity1.Name);
            Assert.AreEqual(0, childEntity1.Order);

            MacroStabilityInwardsCalculationEntity childEntity2 = childCalculationEntities[1];

            Assert.AreEqual("B", childEntity2.Name);
            Assert.AreEqual(1, childEntity2.Order);
        }
示例#10
0
        public void Create_GroupWithChildWaveImpactAsphaltCoverWaveConditionsCalculations_CreateEntities()
        {
            // Setup
            var group = new CalculationGroup
            {
                Children =
                {
                    new WaveImpactAsphaltCoverWaveConditionsCalculation
                    {
                        Name = "A"
                    },
                    new WaveImpactAsphaltCoverWaveConditionsCalculation
                    {
                        Name = "B"
                    }
                }
            };

            var registry = new PersistenceRegistry();

            // Call
            CalculationGroupEntity entity = group.Create(registry, 0);

            // Assert
            WaveImpactAsphaltCoverWaveConditionsCalculationEntity[] childCalculationEntities = entity.WaveImpactAsphaltCoverWaveConditionsCalculationEntities.ToArray();
            Assert.AreEqual(2, childCalculationEntities.Length);

            WaveImpactAsphaltCoverWaveConditionsCalculationEntity childEntity1 = childCalculationEntities[0];

            Assert.AreEqual("A", childEntity1.Name);
            Assert.AreEqual(0, childEntity1.Order);
            WaveImpactAsphaltCoverWaveConditionsCalculationEntity childEntity2 = childCalculationEntities[1];

            Assert.AreEqual("B", childEntity2.Name);
            Assert.AreEqual(1, childEntity2.Order);
        }
示例#11
0
        public void Create_GroupWithChildHeightStructuresCalculations_CreateEntities()
        {
            // Setup
            var group = new CalculationGroup
            {
                Children =
                {
                    new StructuresCalculationScenario <HeightStructuresInput>
                    {
                        Name = "A"
                    },
                    new StructuresCalculationScenario <HeightStructuresInput>
                    {
                        Name = "B"
                    }
                }
            };

            var registry = new PersistenceRegistry();

            // Call
            CalculationGroupEntity entity = group.Create(registry, 0);

            // Assert
            HeightStructuresCalculationEntity[] childCalculationEntities = entity.HeightStructuresCalculationEntities.ToArray();
            Assert.AreEqual(2, childCalculationEntities.Length);

            HeightStructuresCalculationEntity childEntity1 = childCalculationEntities[0];

            Assert.AreEqual("A", childEntity1.Name);
            Assert.AreEqual(0, childEntity1.Order);
            HeightStructuresCalculationEntity childEntity2 = childCalculationEntities[1];

            Assert.AreEqual("B", childEntity2.Name);
            Assert.AreEqual(1, childEntity2.Order);
        }
示例#12
0
        public void Create_GroupWithChildProbabilisticPipingCalculations_CreateEntities()
        {
            // Setup
            var group = new CalculationGroup
            {
                Children =
                {
                    new ProbabilisticPipingCalculationScenario
                    {
                        Name = "A"
                    },
                    new ProbabilisticPipingCalculationScenario
                    {
                        Name = "B"
                    }
                }
            };

            var registry = new PersistenceRegistry();

            // Call
            CalculationGroupEntity entity = group.Create(registry, 0);

            // Assert
            ProbabilisticPipingCalculationEntity[] probabilisticChildCalculationEntities = entity.ProbabilisticPipingCalculationEntities.ToArray();
            Assert.AreEqual(2, probabilisticChildCalculationEntities.Length);

            ProbabilisticPipingCalculationEntity childEntity1 = probabilisticChildCalculationEntities[0];

            Assert.AreEqual("A", childEntity1.Name);
            Assert.AreEqual(0, childEntity1.Order);
            ProbabilisticPipingCalculationEntity childEntity2 = probabilisticChildCalculationEntities[1];

            Assert.AreEqual("B", childEntity2.Name);
            Assert.AreEqual(1, childEntity2.Order);
        }
示例#13
0
        private static void CreateChildElements(CalculationGroup parentGroup, CalculationGroupEntity entity, PersistenceRegistry registry)
        {
            for (var i = 0; i < parentGroup.Children.Count; i++)
            {
                ICalculationBase calculationBase = parentGroup.Children[i];

                if (calculationBase is CalculationGroup childGroup)
                {
                    entity.CalculationGroupEntity1.Add(childGroup.Create(registry, i));
                }

                if (calculationBase is SemiProbabilisticPipingCalculationScenario childSemiProbabilisticPipingCalculation)
                {
                    entity.SemiProbabilisticPipingCalculationEntities.Add(childSemiProbabilisticPipingCalculation.Create(registry, i));
                }

                if (calculationBase is ProbabilisticPipingCalculationScenario childProbabilisticPipingCalculation)
                {
                    entity.ProbabilisticPipingCalculationEntities.Add(childProbabilisticPipingCalculation.Create(registry, i));
                }

                if (calculationBase is MacroStabilityInwardsCalculationScenario childMacroStabilityInwardsCalculation)
                {
                    entity.MacroStabilityInwardsCalculationEntities.Add(childMacroStabilityInwardsCalculation.Create(registry, i));
                }

                if (calculationBase is GrassCoverErosionInwardsCalculationScenario childGrassCoverErosionInwardsCalculation)
                {
                    entity.GrassCoverErosionInwardsCalculationEntities.Add(childGrassCoverErosionInwardsCalculation.Create(registry, i));
                }

                if (calculationBase is GrassCoverErosionOutwardsWaveConditionsCalculation childGrassCoverErosionOutwardsCalculation)
                {
                    entity.GrassCoverErosionOutwardsWaveConditionsCalculationEntities.Add(childGrassCoverErosionOutwardsCalculation.Create(registry, i));
                }

                if (calculationBase is StructuresCalculationScenario <HeightStructuresInput> childHeightStructuresCalculation)
                {
                    entity.HeightStructuresCalculationEntities.Add(childHeightStructuresCalculation.CreateForHeightStructures(registry, i));
                }

                if (calculationBase is StructuresCalculationScenario <ClosingStructuresInput> childClosingStructuresCalculation)
                {
                    entity.ClosingStructuresCalculationEntities.Add(childClosingStructuresCalculation.CreateForClosingStructures(registry, i));
                }

                if (calculationBase is StructuresCalculationScenario <StabilityPointStructuresInput> childStabilityPointStructuresCalculation)
                {
                    entity.StabilityPointStructuresCalculationEntities.Add(childStabilityPointStructuresCalculation.CreateForStabilityPointStructures(registry, i));
                }

                if (calculationBase is StabilityStoneCoverWaveConditionsCalculation stabilityStoneCoverWaveConditionsCalculation)
                {
                    entity.StabilityStoneCoverWaveConditionsCalculationEntities.Add(stabilityStoneCoverWaveConditionsCalculation.Create(registry, i));
                }

                if (calculationBase is WaveImpactAsphaltCoverWaveConditionsCalculation waveImpactAsphaltCoverWaveConditionsCalculation)
                {
                    entity.WaveImpactAsphaltCoverWaveConditionsCalculationEntities.Add(waveImpactAsphaltCoverWaveConditionsCalculation.Create(registry, i));
                }
            }
        }
示例#14
0
        public void Create_GroupWithChildPipingCalculationsAndChildCalculationGroups_CreateEntities()
        {
            // Setup
            var group = new CalculationGroup
            {
                Children =
                {
                    new CalculationGroup
                    {
                        Name = "A"
                    },
                    new SemiProbabilisticPipingCalculationScenario
                    {
                        Name = "B"
                    },
                    new ProbabilisticPipingCalculationScenario
                    {
                        Name = "C"
                    },
                    new CalculationGroup
                    {
                        Name = "D"
                    },
                    new SemiProbabilisticPipingCalculationScenario
                    {
                        Name = "E"
                    },
                    new ProbabilisticPipingCalculationScenario
                    {
                        Name = "F"
                    }
                }
            };

            var registry = new PersistenceRegistry();

            // Call
            CalculationGroupEntity entity = group.Create(registry, 0);

            // Assert
            CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity1.ToArray();
            SemiProbabilisticPipingCalculationEntity[] semiProbabilisticChildCalculationEntities = entity.SemiProbabilisticPipingCalculationEntities.ToArray();
            ProbabilisticPipingCalculationEntity[]     probabilisticChildCalculationEntities     = entity.ProbabilisticPipingCalculationEntities.ToArray();

            Assert.AreEqual(2, childGroupEntities.Length);
            Assert.AreEqual(2, semiProbabilisticChildCalculationEntities.Length);
            Assert.AreEqual(2, probabilisticChildCalculationEntities.Length);

            CalculationGroupEntity childEntity1 = childGroupEntities[0];

            Assert.AreEqual("A", childEntity1.Name);
            Assert.AreEqual(0, childEntity1.Order);
            CollectionAssert.IsEmpty(childEntity1.CalculationGroupEntity1);

            SemiProbabilisticPipingCalculationEntity childEntity2 = semiProbabilisticChildCalculationEntities[0];

            Assert.AreEqual("B", childEntity2.Name);
            Assert.AreEqual(1, childEntity2.Order);

            ProbabilisticPipingCalculationEntity childEntity3 = probabilisticChildCalculationEntities[0];

            Assert.AreEqual("C", childEntity3.Name);
            Assert.AreEqual(2, childEntity3.Order);

            CalculationGroupEntity childEntity4 = childGroupEntities[1];

            Assert.AreEqual("D", childEntity4.Name);
            Assert.AreEqual(3, childEntity4.Order);
            CollectionAssert.IsEmpty(childEntity4.CalculationGroupEntity1);

            SemiProbabilisticPipingCalculationEntity childEntity5 = semiProbabilisticChildCalculationEntities[1];

            Assert.AreEqual("E", childEntity5.Name);
            Assert.AreEqual(4, childEntity5.Order);

            ProbabilisticPipingCalculationEntity childEntity6 = probabilisticChildCalculationEntities[1];

            Assert.AreEqual("F", childEntity6.Name);
            Assert.AreEqual(5, childEntity6.Order);
        }
示例#15
0
        public void Create_GroupWithChildren_CreateEntities()
        {
            // Setup
            const string name  = "blaballab";
            var          group = new CalculationGroup
            {
                Name = name
            };

            group.Children.Add(new CalculationGroup
            {
                Name     = "A",
                Children =
                {
                    new CalculationGroup
                    {
                        Name = "AA"
                    },
                    new CalculationGroup
                    {
                        Name = "AB"
                    }
                }
            });
            group.Children.Add(new CalculationGroup
            {
                Name = "B"
            });

            var registry = new PersistenceRegistry();

            // Call
            CalculationGroupEntity entity = group.Create(registry, 0);

            // Assert
            Assert.AreEqual(name, entity.Name);
            Assert.AreEqual(0, entity.Order);

            CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity1.ToArray();
            Assert.AreEqual(2, childGroupEntities.Length);

            CalculationGroupEntity childEntity1 = childGroupEntities[0];

            Assert.AreEqual("A", childEntity1.Name);
            Assert.AreEqual(0, childEntity1.Order);
            Assert.AreEqual(2, childEntity1.CalculationGroupEntity1.Count);
            CalculationGroupEntity childEntity1ChildEntity1 = childEntity1.CalculationGroupEntity1.ElementAt(0);

            Assert.AreEqual("AA", childEntity1ChildEntity1.Name);
            Assert.AreEqual(0, childEntity1ChildEntity1.Order);
            CollectionAssert.IsEmpty(childEntity1ChildEntity1.CalculationGroupEntity1);
            CalculationGroupEntity childEntity1ChildEntity2 = childEntity1.CalculationGroupEntity1.ElementAt(1);

            Assert.AreEqual("AB", childEntity1ChildEntity2.Name);
            Assert.AreEqual(1, childEntity1ChildEntity2.Order);
            CollectionAssert.IsEmpty(childEntity1ChildEntity2.CalculationGroupEntity1);

            CalculationGroupEntity childEntity2 = childGroupEntities[1];

            Assert.AreEqual("B", childEntity2.Name);
            Assert.AreEqual(1, childEntity2.Order);
            CollectionAssert.IsEmpty(childEntity2.CalculationGroupEntity1);
        }
示例#16
0
        private static IEnumerable GetChildEntitiesInOrder(CalculationGroupEntity entity)
        {
            var sortedList = new SortedList();

            foreach (CalculationGroupEntity groupEntity in entity.CalculationGroupEntity1)
            {
                sortedList.Add(groupEntity.Order, groupEntity);
            }

            foreach (SemiProbabilisticPipingCalculationEntity calculationEntity in entity.SemiProbabilisticPipingCalculationEntities)
            {
                sortedList.Add(calculationEntity.Order, calculationEntity);
            }

            foreach (ProbabilisticPipingCalculationEntity calculationEntity in entity.ProbabilisticPipingCalculationEntities)
            {
                sortedList.Add(calculationEntity.Order, calculationEntity);
            }

            foreach (GrassCoverErosionInwardsCalculationEntity calculationEntity in entity.GrassCoverErosionInwardsCalculationEntities)
            {
                sortedList.Add(calculationEntity.Order, calculationEntity);
            }

            foreach (GrassCoverErosionOutwardsWaveConditionsCalculationEntity calculationEntity in entity.GrassCoverErosionOutwardsWaveConditionsCalculationEntities)
            {
                sortedList.Add(calculationEntity.Order, calculationEntity);
            }

            foreach (HeightStructuresCalculationEntity calculationEntity in entity.HeightStructuresCalculationEntities)
            {
                sortedList.Add(calculationEntity.Order, calculationEntity);
            }

            foreach (ClosingStructuresCalculationEntity calculationEntity in entity.ClosingStructuresCalculationEntities)
            {
                sortedList.Add(calculationEntity.Order, calculationEntity);
            }

            foreach (StabilityPointStructuresCalculationEntity calculationEntity in entity.StabilityPointStructuresCalculationEntities)
            {
                sortedList.Add(calculationEntity.Order, calculationEntity);
            }

            foreach (StabilityStoneCoverWaveConditionsCalculationEntity calculationEntity in entity.StabilityStoneCoverWaveConditionsCalculationEntities)
            {
                sortedList.Add(calculationEntity.Order, calculationEntity);
            }

            foreach (WaveImpactAsphaltCoverWaveConditionsCalculationEntity calculationEntity in entity.WaveImpactAsphaltCoverWaveConditionsCalculationEntities)
            {
                sortedList.Add(calculationEntity.Order, calculationEntity);
            }

            foreach (MacroStabilityInwardsCalculationEntity calculationEntity in entity.MacroStabilityInwardsCalculationEntities)
            {
                sortedList.Add(calculationEntity.Order, calculationEntity);
            }

            return(sortedList.Values);
        }