예제 #1
0
        public void Create_SurfaceLineWithoutGeometry_ReturnSurfaceLineEntityWithoutAddingPointEntities()
        {
            // Setup
            var random      = new Random(31);
            int order       = random.Next();
            var registry    = new PersistenceRegistry();
            var surfaceLine = new PipingSurfaceLine("Test")
            {
                ReferenceLineIntersectionWorldPoint = new Point2D(random.NextDouble(), random.NextDouble())
            };

            // Call
            SurfaceLineEntity entity = surfaceLine.Create(registry, order);

            // Assert
            Assert.AreEqual(surfaceLine.Name, entity.Name);
            Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX);
            Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY);
            Assert.AreEqual(order, entity.Order);

            Assert.IsNull(entity.FailureMechanismEntity);
            IEnumerable <Point3D> points = new Point3D[0];
            string expectedXml           = new Point3DCollectionXmlSerializer().ToXml(points);

            Assert.AreEqual(expectedXml, entity.PointsXml);
        }
예제 #2
0
        /// <summary>
        /// Read the <see cref="SurfaceLineEntity"/> and use the information to construct
        /// a <see cref="PipingSurfaceLine"/>.
        /// </summary>
        /// <param name="entity">The <see cref="SurfaceLineEntity"/> to create
        /// <see cref="PipingSurfaceLine"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="PipingSurfaceLine"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when <see cref="SurfaceLineEntity.PointsXml"/>
        /// of <paramref name="entity"/> is empty.</exception>
        /// <exception cref="InvalidEnumArgumentException">Thrown when the <paramref name="entity"/>
        /// contains an invalid type of characteristic point.</exception>
        /// <exception cref="NotSupportedException">Thrown when the <paramref name="entity"/> contains a
        /// characteristic point that is not supported.</exception>
        public static PipingSurfaceLine ReadAsPipingSurfaceLine(this SurfaceLineEntity entity,
                                                                ReadConversionCollector collector)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.ContainsPipingSurfaceLine(entity))
            {
                return(collector.GetPipingSurfaceLine(entity));
            }

            var surfaceLine = new PipingSurfaceLine(entity.Name)
            {
                ReferenceLineIntersectionWorldPoint = GetReferenceLineIntersectionWorldPoint(entity)
            };

            surfaceLine.SetGeometry(ReadGeometryPoints(entity.PointsXml));
            entity.ReadCharacteristicPoints(surfaceLine);

            collector.Read(entity, surfaceLine);

            return(surfaceLine);
        }
        public void Create_SurfaceLineWithoutGeometry_ReturnSurfaceLineEntityWithoutAddingPointEntities()
        {
            // Setup
            var random      = new Random(31);
            var registry    = new PersistenceRegistry();
            var surfaceLine = new MacroStabilityInwardsSurfaceLine("Test")
            {
                ReferenceLineIntersectionWorldPoint = GetRandomPoint2D(random)
            };
            int order = random.Next();

            // Call
            SurfaceLineEntity entity = surfaceLine.Create(registry, order);

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreEqual(surfaceLine.Name, entity.Name);
            Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX);
            Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY);
            Assert.AreEqual(order, entity.Order);

            string expectedXml = new Point3DCollectionXmlSerializer().ToXml(new Point3D[0]);

            Assert.AreEqual(expectedXml, entity.PointsXml);
        }
        public void Read_EntityWithSurfaceLineInCollector_CalculationHasAlreadyReadSurfaceLine()
        {
            // Setup
            var surfaceLine = new PipingSurfaceLine(string.Empty);

            surfaceLine.SetGeometry(new[]
            {
                new Point3D(1, 2, 3),
                new Point3D(4, 5, 6)
            });
            var surfaceLineEntity = new SurfaceLineEntity();
            var entity            = new SemiProbabilisticPipingCalculationEntity
            {
                SurfaceLineEntity     = surfaceLineEntity,
                EntryPointL           = 1,
                ExitPointL            = 2,
                DampingFactorExitMean = 1,
                ScenarioContribution  = 0
            };

            var collector = new ReadConversionCollector();

            collector.Read(surfaceLineEntity, surfaceLine);

            // Call
            SemiProbabilisticPipingCalculationScenario calculation = entity.Read(collector);

            // Assert
            Assert.AreSame(surfaceLine, calculation.InputParameters.SurfaceLine);
            Assert.AreEqual(1, calculation.InputParameters.EntryPointL, 1e-6);
            Assert.AreEqual(2, calculation.InputParameters.ExitPointL, 1e-6);
        }
예제 #5
0
        public void ReadAsPipingSurfaceLine_SurfaceLineEntityWithoutGeometryPointXml_ReturnSurfaceLine()
        {
            // Setup
            var collector = new ReadConversionCollector();
            var random    = new Random(31);

            var entity = new SurfaceLineEntity
            {
                Name = "nice name!",
                ReferenceLineIntersectionX = random.NextDouble(),
                ReferenceLineIntersectionY = random.NextDouble(),
                PointsXml = new Point3DCollectionXmlSerializer().ToXml(new Point3D[0])
            };

            // Call
            PipingSurfaceLine surfaceLine = entity.ReadAsPipingSurfaceLine(collector);

            // Assert
            Assert.AreEqual(entity.Name, surfaceLine.Name);
            Assert.AreEqual(entity.ReferenceLineIntersectionX, surfaceLine.ReferenceLineIntersectionWorldPoint.X);
            Assert.AreEqual(entity.ReferenceLineIntersectionY, surfaceLine.ReferenceLineIntersectionWorldPoint.Y);

            CollectionAssert.IsEmpty(surfaceLine.Points);

            Assert.IsNull(surfaceLine.BottomDitchDikeSide);
            Assert.IsNull(surfaceLine.BottomDitchPolderSide);
            Assert.IsNull(surfaceLine.DikeToeAtPolder);
            Assert.IsNull(surfaceLine.DikeToeAtRiver);
            Assert.IsNull(surfaceLine.DitchDikeSide);
            Assert.IsNull(surfaceLine.DitchPolderSide);
        }
        public void Read_EntityWithSurfaceLineNotYetInCollector_CalculationWithCreatedSurfaceLineAndRegisteredNewEntities()
        {
            // Setup
            var points = new[]
            {
                new Point3D(1, 3, 4),
                new Point3D(7, 10, 11)
            };

            var surfaceLineEntity = new SurfaceLineEntity
            {
                Name      = "surface line",
                PointsXml = new Point3DCollectionXmlSerializer().ToXml(points)
            };

            var entity = new SemiProbabilisticPipingCalculationEntity
            {
                SurfaceLineEntity     = surfaceLineEntity,
                EntryPointL           = 1,
                ExitPointL            = 2,
                DampingFactorExitMean = 1,
                ScenarioContribution  = 0
            };

            var collector = new ReadConversionCollector();

            // Call
            SemiProbabilisticPipingCalculationScenario calculation = entity.Read(collector);

            // Assert
            Assert.IsTrue(collector.ContainsPipingSurfaceLine(surfaceLineEntity));
            CollectionAssert.AreEqual(points, calculation.InputParameters.SurfaceLine.Points);
        }
예제 #7
0
        public void Create_HasSurfaceLineSet_EntityHasSurfaceLineEntity()
        {
            // Setup
            var surfaceLine = new PipingSurfaceLine(string.Empty)
            {
                ReferenceLineIntersectionWorldPoint = new Point2D(1.1, 2.2)
            };

            surfaceLine.SetGeometry(new[]
            {
                new Point3D(0.0, 0.0, 1.0),
                new Point3D(3.3, 6.6, 1.0)
            });

            var registry = new PersistenceRegistry();
            SurfaceLineEntity surfaceLineEntity = surfaceLine.Create(registry, 0);

            var calculation = new ProbabilisticPipingCalculationScenario
            {
                InputParameters =
                {
                    SurfaceLine = surfaceLine
                }
            };

            // Call
            ProbabilisticPipingCalculationEntity entity = calculation.Create(registry, 0);

            // Assert
            Assert.AreSame(surfaceLineEntity, entity.SurfaceLineEntity);
        }
예제 #8
0
        /// <summary>
        /// Creates a <see cref="SurfaceLineEntity"/> based on the information of the <see cref="MacroStabilityInwardsSurfaceLine"/>.
        /// </summary>
        /// <param name="surfaceLine">The surface line to create a database entity for.</param>
        /// <param name="registry">The object keeping track of create operations.</param>
        /// <param name="order">Index at which this instance resides inside its parent container.</param>
        /// <returns>A new <see cref="SurfaceLineEntity"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception>
        internal static SurfaceLineEntity Create(this MacroStabilityInwardsSurfaceLine surfaceLine,
                                                 PersistenceRegistry registry,
                                                 int order)
        {
            if (surfaceLine == null)
            {
                throw new ArgumentNullException(nameof(surfaceLine));
            }

            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

            if (registry.Contains(surfaceLine))
            {
                return(registry.Get(surfaceLine));
            }

            var entity = new SurfaceLineEntity
            {
                Name = surfaceLine.Name.DeepClone(),
                ReferenceLineIntersectionX = surfaceLine.ReferenceLineIntersectionWorldPoint?.X.ToNaNAsNull(),
                ReferenceLineIntersectionY = surfaceLine.ReferenceLineIntersectionWorldPoint?.Y.ToNaNAsNull(),
                PointsXml = new Point3DCollectionXmlSerializer().ToXml(surfaceLine.Points),
                Order     = order
            };

            CreateCharacteristicPointEntities(surfaceLine, entity);

            registry.Register(entity, surfaceLine);

            return(entity);
        }
예제 #9
0
        public void ReadAsMacroStabilityInwardsSurfaceLine_SurfaceLineEntityWithPointsAndAllCharacteristicPointsSetToSamePoint_ReturnsExpectedSurfaceLine()
        {
            // Setup
            var collector = new ReadConversionCollector();
            var random    = new Random(31);

            Point3D[] points =
            {
                CreatePoint3D(random),
                CreatePoint3D(random)
            };

            var entity = new SurfaceLineEntity
            {
                Name = "Better name.",
                ReferenceLineIntersectionX = random.NextDouble(),
                ReferenceLineIntersectionY = random.NextDouble(),
                PointsXml = new Point3DCollectionXmlSerializer().ToXml(points),
                MacroStabilityInwardsCharacteristicPointEntities =
                {
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.SurfaceLevelOutside),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.DikeToeAtRiver),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.DikeTopAtPolder),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.DikeTopAtRiver),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.ShoulderBaseInside),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.ShoulderTopInside),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.DikeToeAtPolder),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.DitchDikeSide),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.BottomDitchDikeSide),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.BottomDitchPolderSide),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.DitchPolderSide),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.SurfaceLevelInside)
                }
            };

            // Call
            MacroStabilityInwardsSurfaceLine surfaceLine = entity.ReadAsMacroStabilityInwardsSurfaceLine(collector);

            // Assert
            Assert.AreEqual(entity.Name, surfaceLine.Name);
            Assert.AreEqual(entity.ReferenceLineIntersectionX, surfaceLine.ReferenceLineIntersectionWorldPoint.X);
            Assert.AreEqual(entity.ReferenceLineIntersectionY, surfaceLine.ReferenceLineIntersectionWorldPoint.Y);

            Point3D[] geometry = surfaceLine.Points.ToArray();
            Assert.AreEqual(2, geometry.Length);
            Point3D geometryPoint = geometry[0];

            Assert.AreSame(geometryPoint, surfaceLine.SurfaceLevelOutside);
            Assert.AreSame(geometryPoint, surfaceLine.DikeToeAtRiver);
            Assert.AreSame(geometryPoint, surfaceLine.DikeTopAtPolder);
            Assert.AreSame(geometryPoint, surfaceLine.DikeTopAtRiver);
            Assert.AreSame(geometryPoint, surfaceLine.ShoulderBaseInside);
            Assert.AreSame(geometryPoint, surfaceLine.ShoulderTopInside);
            Assert.AreSame(geometryPoint, surfaceLine.DikeToeAtPolder);
            Assert.AreSame(geometryPoint, surfaceLine.DitchDikeSide);
            Assert.AreSame(geometryPoint, surfaceLine.BottomDitchDikeSide);
            Assert.AreSame(geometryPoint, surfaceLine.BottomDitchPolderSide);
            Assert.AreSame(geometryPoint, surfaceLine.DitchPolderSide);
            Assert.AreSame(geometryPoint, surfaceLine.SurfaceLevelInside);
        }
예제 #10
0
        public void ReadAsMacroStabilityInwardsSurfaceLine_WithInvalidMacroStabilityCharacteristicPointType_ThrowsInvalidEnumArgumentException()
        {
            // Setup
            var random = new Random(31);

            Point3D[] points =
            {
                CreatePoint3D(random)
            };

            const byte invalidCharacteristicPointType = 37;
            var        entity = new SurfaceLineEntity
            {
                Name = "Better name.",
                ReferenceLineIntersectionX = random.NextDouble(),
                ReferenceLineIntersectionY = random.NextDouble(),
                PointsXml = new Point3DCollectionXmlSerializer().ToXml(points),
                MacroStabilityInwardsCharacteristicPointEntities =
                {
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], (MacroStabilityInwardsCharacteristicPointType)invalidCharacteristicPointType)
                }
            };

            // Call
            TestDelegate call = () => entity.ReadAsMacroStabilityInwardsSurfaceLine(new ReadConversionCollector());

            // Assert
            string exoectedMessage = $"The value of argument 'type' ({invalidCharacteristicPointType}) is invalid for Enum type '{nameof(MacroStabilityInwardsCharacteristicPointType)}'.";
            string parameterName   = TestHelper.AssertThrowsArgumentExceptionAndTestMessage <InvalidEnumArgumentException>(call, exoectedMessage).ParamName;

            Assert.AreEqual("type", parameterName);
        }
예제 #11
0
        private static void AssertSurfaceLine(PipingSurfaceLine surfaceLine, SurfaceLineEntity entity)
        {
            Assert.AreEqual(surfaceLine.Name, entity.Name);
            Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX);
            Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY);

            Assert.AreEqual(6, entity.PipingCharacteristicPointEntities.Count);
            CollectionAssert.IsEmpty(entity.MacroStabilityInwardsCharacteristicPointEntities);
        }
예제 #12
0
        public void Create_SurfaceLineWithCharacteristicPointsOnSameGeometryPoint_ReturnSurfaceLineEntityWithPointEntitiesAndCharactersisticPointReferences()
        {
            // Setup
            var random   = new Random(31);
            var registry = new PersistenceRegistry();
            var geometry = new[]
            {
                new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble())
            };
            var surfaceLine = new PipingSurfaceLine("Test")
            {
                ReferenceLineIntersectionWorldPoint = new Point2D(random.NextDouble(), random.NextDouble())
            };

            surfaceLine.SetGeometry(geometry);
            surfaceLine.SetBottomDitchDikeSideAt(geometry[0]);
            surfaceLine.SetBottomDitchPolderSideAt(geometry[0]);
            surfaceLine.SetDikeToeAtPolderAt(geometry[0]);
            surfaceLine.SetDikeToeAtRiverAt(geometry[0]);
            surfaceLine.SetDitchDikeSideAt(geometry[0]);
            surfaceLine.SetDitchPolderSideAt(geometry[0]);

            // Call
            SurfaceLineEntity entity = surfaceLine.Create(registry, 0);

            // Assert
            Assert.AreEqual(surfaceLine.Name, entity.Name);
            Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX);
            Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY);

            string expectedXml = new Point3DCollectionXmlSerializer().ToXml(geometry);

            Assert.AreEqual(expectedXml, entity.PointsXml);

            Assert.AreEqual(6, entity.PipingCharacteristicPointEntities.Count);

            CollectionAssert.AreEquivalent(new[]
            {
                (byte)PipingCharacteristicPointType.DikeToeAtRiver,
                (byte)PipingCharacteristicPointType.DikeToeAtPolder,
                (byte)PipingCharacteristicPointType.DitchDikeSide,
                (byte)PipingCharacteristicPointType.BottomDitchDikeSide,
                (byte)PipingCharacteristicPointType.BottomDitchPolderSide,
                (byte)PipingCharacteristicPointType.DitchPolderSide
            }, entity.PipingCharacteristicPointEntities
                                           .Select(cpe => cpe.Type));

            foreach (PipingCharacteristicPointEntity characteristicPointEntity in entity.PipingCharacteristicPointEntities)
            {
                Assert.AreEqual(geometry[0].X, characteristicPointEntity.X);
                Assert.AreEqual(geometry[0].Y, characteristicPointEntity.Y);
                Assert.AreEqual(geometry[0].Z, characteristicPointEntity.Z);
            }
        }
예제 #13
0
        public void ReadAsMacroStabilityInwardsSurfaceLine_SurfaceLineEntityWithGeometryPointXmlAndCharacteristicPoints_ReturnFullSurfaceLine()
        {
            // Setup
            var collector = new ReadConversionCollector();
            var random    = new Random(31);

            Point3D[] points = Array.ConvertAll(new Point3D[12], p => CreatePoint3D(random));

            var entity = new SurfaceLineEntity
            {
                Name = "Better name.",
                ReferenceLineIntersectionX = random.NextDouble(),
                ReferenceLineIntersectionY = random.NextDouble(),
                PointsXml = new Point3DCollectionXmlSerializer().ToXml(points),
                MacroStabilityInwardsCharacteristicPointEntities =
                {
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[0],  MacroStabilityInwardsCharacteristicPointType.SurfaceLevelOutside),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[1],  MacroStabilityInwardsCharacteristicPointType.DikeToeAtRiver),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[2],  MacroStabilityInwardsCharacteristicPointType.DikeTopAtPolder),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[3],  MacroStabilityInwardsCharacteristicPointType.DikeTopAtRiver),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[4],  MacroStabilityInwardsCharacteristicPointType.ShoulderBaseInside),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[5],  MacroStabilityInwardsCharacteristicPointType.ShoulderTopInside),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[6],  MacroStabilityInwardsCharacteristicPointType.DikeToeAtPolder),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[7],  MacroStabilityInwardsCharacteristicPointType.DitchDikeSide),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[8],  MacroStabilityInwardsCharacteristicPointType.BottomDitchDikeSide),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[9],  MacroStabilityInwardsCharacteristicPointType.BottomDitchPolderSide),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[10], MacroStabilityInwardsCharacteristicPointType.DitchPolderSide),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(points[11], MacroStabilityInwardsCharacteristicPointType.SurfaceLevelInside)
                }
            };

            // Call
            MacroStabilityInwardsSurfaceLine surfaceLine = entity.ReadAsMacroStabilityInwardsSurfaceLine(collector);

            // Assert
            Assert.AreEqual(entity.Name, surfaceLine.Name);
            Assert.AreEqual(entity.ReferenceLineIntersectionX, surfaceLine.ReferenceLineIntersectionWorldPoint.X);
            Assert.AreEqual(entity.ReferenceLineIntersectionY, surfaceLine.ReferenceLineIntersectionWorldPoint.Y);

            CollectionAssert.AreEqual(points, surfaceLine.Points);

            Assert.AreSame(surfaceLine.Points.ElementAt(0), surfaceLine.SurfaceLevelOutside);
            Assert.AreSame(surfaceLine.Points.ElementAt(1), surfaceLine.DikeToeAtRiver);
            Assert.AreSame(surfaceLine.Points.ElementAt(2), surfaceLine.DikeTopAtPolder);
            Assert.AreSame(surfaceLine.Points.ElementAt(3), surfaceLine.DikeTopAtRiver);
            Assert.AreSame(surfaceLine.Points.ElementAt(4), surfaceLine.ShoulderBaseInside);
            Assert.AreSame(surfaceLine.Points.ElementAt(5), surfaceLine.ShoulderTopInside);
            Assert.AreSame(surfaceLine.Points.ElementAt(6), surfaceLine.DikeToeAtPolder);
            Assert.AreSame(surfaceLine.Points.ElementAt(7), surfaceLine.DitchDikeSide);
            Assert.AreSame(surfaceLine.Points.ElementAt(8), surfaceLine.BottomDitchDikeSide);
            Assert.AreSame(surfaceLine.Points.ElementAt(9), surfaceLine.BottomDitchPolderSide);
            Assert.AreSame(surfaceLine.Points.ElementAt(10), surfaceLine.DitchPolderSide);
            Assert.AreSame(surfaceLine.Points.ElementAt(11), surfaceLine.SurfaceLevelInside);
        }
예제 #14
0
        public void Create_StringPropertiesDoNotShareReference()
        {
            // Setup
            var registry    = new PersistenceRegistry();
            var surfaceLine = new PipingSurfaceLine("Test");

            // Call
            SurfaceLineEntity entity = surfaceLine.Create(registry, 0);

            // Assert
            TestHelper.AssertAreEqualButNotSame(surfaceLine.Name, entity.Name);
        }
예제 #15
0
        public void ReadAsMacroStabilityInwardsSurfaceLine_WithNullValues_ReturnsMacroStabilityInwardsSurfaceLineWithNaNValues()
        {
            // Setup
            var collector = new ReadConversionCollector();
            var point3D   = new Point3D(double.NaN, double.NaN, double.NaN);
            var entity    = new SurfaceLineEntity
            {
                Name      = "name",
                PointsXml = new Point3DCollectionXmlSerializer().ToXml(new[]
                {
                    point3D
                }),
                MacroStabilityInwardsCharacteristicPointEntities =
                {
                    CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.SurfaceLevelOutside),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.DikeToeAtRiver),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.DikeTopAtPolder),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.DikeTopAtRiver),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.ShoulderBaseInside),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.ShoulderTopInside),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.DikeToeAtPolder),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.DitchDikeSide),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.BottomDitchDikeSide),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.BottomDitchPolderSide),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.DitchPolderSide),
                    CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.SurfaceLevelInside)
                }
            };

            // Call
            MacroStabilityInwardsSurfaceLine surfaceLine = entity.ReadAsMacroStabilityInwardsSurfaceLine(collector);

            // Assert
            Assert.AreEqual(entity.Name, surfaceLine.Name);
            Assert.IsNaN(surfaceLine.ReferenceLineIntersectionWorldPoint.X);
            Assert.IsNaN(surfaceLine.ReferenceLineIntersectionWorldPoint.Y);

            Point3D geometryPoint = surfaceLine.Points.Single();

            Assert.AreSame(geometryPoint, surfaceLine.SurfaceLevelOutside);
            Assert.AreSame(geometryPoint, surfaceLine.DikeToeAtRiver);
            Assert.AreSame(geometryPoint, surfaceLine.DikeTopAtPolder);
            Assert.AreSame(geometryPoint, surfaceLine.DikeTopAtRiver);
            Assert.AreSame(geometryPoint, surfaceLine.ShoulderBaseInside);
            Assert.AreSame(geometryPoint, surfaceLine.ShoulderTopInside);
            Assert.AreSame(geometryPoint, surfaceLine.DikeToeAtPolder);
            Assert.AreSame(geometryPoint, surfaceLine.DitchDikeSide);
            Assert.AreSame(geometryPoint, surfaceLine.BottomDitchDikeSide);
            Assert.AreSame(geometryPoint, surfaceLine.BottomDitchPolderSide);
            Assert.AreSame(geometryPoint, surfaceLine.DitchPolderSide);
            Assert.AreSame(geometryPoint, surfaceLine.SurfaceLevelInside);
        }
예제 #16
0
        public void ReadAsPipingSurfaceLine_CollectorNull_ThrowArgumentNullException()
        {
            // Setup
            var entity = new SurfaceLineEntity();

            // Call
            TestDelegate call = () => entity.ReadAsPipingSurfaceLine(null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(call);

            Assert.AreEqual("collector", exception.ParamName);
        }
        public void Create_CreatingEntityForSameSurfaceLine_ReturnSameEntity()
        {
            // Setup
            var surfaceLine = new MacroStabilityInwardsSurfaceLine(string.Empty);
            var registry    = new PersistenceRegistry();

            // Call
            SurfaceLineEntity entity1 = surfaceLine.Create(registry, 0);
            SurfaceLineEntity entity2 = surfaceLine.Create(registry, 0);

            // Assert
            Assert.AreSame(entity1, entity2);
        }
예제 #18
0
        /// <summary>
        /// Reads the characteristic points from the <paramref name="entity"/> and sets these
        /// to the <paramref name="surfaceLine"/>.
        /// </summary>
        /// <param name="entity">The entity to read.</param>
        /// <param name="surfaceLine">The surface line to set the characteristic point on.</param>
        /// <exception cref="InvalidEnumArgumentException">Thrown when the <paramref name="entity"/>
        /// contains an invalid type of characteristic point.</exception>
        /// <exception cref="NotSupportedException">Thrown when the <paramref name="entity"/> contains a
        /// characteristic point that is not supported.</exception>
        private static void ReadCharacteristicPoints(this SurfaceLineEntity entity, MacroStabilityInwardsSurfaceLine surfaceLine)
        {
            var characteristicPoints = new Dictionary <MacroStabilityInwardsCharacteristicPointType, Point3D>();

            foreach (MacroStabilityInwardsCharacteristicPointEntity pointEntity in entity.MacroStabilityInwardsCharacteristicPointEntities)
            {
                characteristicPoints[(MacroStabilityInwardsCharacteristicPointType)pointEntity.Type] = new Point3D(pointEntity.X.ToNullAsNaN(),
                                                                                                                   pointEntity.Y.ToNullAsNaN(),
                                                                                                                   pointEntity.Z.ToNullAsNaN());
            }

            characteristicPoints.ForEachElementDo(cp => SetCharacteristicPoint(surfaceLine, cp.Key, cp.Value));
        }
예제 #19
0
        public void ReadAsPipingSurfaceLine_SurfaceLineEntityWithGeometryPointXmlAndCharacteristicPoints_ReturnFullSurfaceLine()
        {
            // Setup
            var collector = new ReadConversionCollector();
            var random    = new Random(31);

            Point3D[] points =
            {
                CreatePoint3D(random),
                CreatePoint3D(random),
                CreatePoint3D(random),
                CreatePoint3D(random),
                CreatePoint3D(random),
                CreatePoint3D(random),
                CreatePoint3D(random)
            };

            var entity = new SurfaceLineEntity
            {
                Name = "Better name.",
                ReferenceLineIntersectionX = random.NextDouble(),
                ReferenceLineIntersectionY = random.NextDouble(),
                PointsXml = new Point3DCollectionXmlSerializer().ToXml(points),
                PipingCharacteristicPointEntities =
                {
                    CreatePipingCharacteristicPointEntity(points[1], PipingCharacteristicPointType.BottomDitchDikeSide),
                    CreatePipingCharacteristicPointEntity(points[2], PipingCharacteristicPointType.BottomDitchPolderSide),
                    CreatePipingCharacteristicPointEntity(points[3], PipingCharacteristicPointType.DikeToeAtPolder),
                    CreatePipingCharacteristicPointEntity(points[4], PipingCharacteristicPointType.DikeToeAtRiver),
                    CreatePipingCharacteristicPointEntity(points[5], PipingCharacteristicPointType.DitchDikeSide),
                    CreatePipingCharacteristicPointEntity(points[6], PipingCharacteristicPointType.DitchPolderSide)
                }
            };

            // Call
            PipingSurfaceLine surfaceLine = entity.ReadAsPipingSurfaceLine(collector);

            // Assert
            Assert.AreEqual(entity.Name, surfaceLine.Name);
            Assert.AreEqual(entity.ReferenceLineIntersectionX, surfaceLine.ReferenceLineIntersectionWorldPoint.X);
            Assert.AreEqual(entity.ReferenceLineIntersectionY, surfaceLine.ReferenceLineIntersectionWorldPoint.Y);

            CollectionAssert.AreEqual(points, surfaceLine.Points);

            Assert.AreSame(surfaceLine.Points.ElementAt(1), surfaceLine.BottomDitchDikeSide);
            Assert.AreSame(surfaceLine.Points.ElementAt(2), surfaceLine.BottomDitchPolderSide);
            Assert.AreSame(surfaceLine.Points.ElementAt(3), surfaceLine.DikeToeAtPolder);
            Assert.AreSame(surfaceLine.Points.ElementAt(4), surfaceLine.DikeToeAtRiver);
            Assert.AreSame(surfaceLine.Points.ElementAt(5), surfaceLine.DitchDikeSide);
            Assert.AreSame(surfaceLine.Points.ElementAt(6), surfaceLine.DitchPolderSide);
        }
예제 #20
0
        public void ReadAsPipingSurfaceLine_PointsXmlEmpty_ThrowsArgumentException()
        {
            var entity = new SurfaceLineEntity
            {
                Name      = "surface line",
                PointsXml = string.Empty
            };

            // Call
            TestDelegate call = () => entity.ReadAsPipingSurfaceLine(new ReadConversionCollector());

            // Assert
            string paramName = Assert.Throws <ArgumentException>(call).ParamName;

            Assert.AreEqual("xml", paramName);
        }
예제 #21
0
        public void ReadAsMacroStabilityInwardsSurfaceLine_SurfaceLineEntityReadMultipleTimes_ReturnSameSurfaceLine()
        {
            // Setup
            var collector = new ReadConversionCollector();

            var entity = new SurfaceLineEntity
            {
                Name      = "surface line",
                PointsXml = new Point3DCollectionXmlSerializer().ToXml(new Point3D[0])
            };

            // Call
            MacroStabilityInwardsSurfaceLine surfaceLine1 = entity.ReadAsMacroStabilityInwardsSurfaceLine(collector);
            MacroStabilityInwardsSurfaceLine surfaceLine2 = entity.ReadAsMacroStabilityInwardsSurfaceLine(collector);

            // Assert
            Assert.AreSame(surfaceLine1, surfaceLine2);
        }
예제 #22
0
        public void ReadAsMacroStabilityInwardsSurfaceLine_SurfaceLineEntityWithGeometryPointXmlButNoCharacteristicPoints_ReturnSurfaceLineWithGeometry()
        {
            // Setup
            var collector = new ReadConversionCollector();
            var random    = new Random(31);

            Point3D[] points =
            {
                CreatePoint3D(random),
                CreatePoint3D(random),
                CreatePoint3D(random)
            };

            var entity = new SurfaceLineEntity
            {
                Name = nameof(SurfaceLineEntity),
                ReferenceLineIntersectionX = random.NextDouble(),
                ReferenceLineIntersectionY = random.NextDouble(),
                PointsXml = new Point3DCollectionXmlSerializer().ToXml(points)
            };

            // Call
            MacroStabilityInwardsSurfaceLine surfaceLine = entity.ReadAsMacroStabilityInwardsSurfaceLine(collector);

            // Assert
            Assert.AreEqual(entity.Name, surfaceLine.Name);
            Assert.AreEqual(entity.ReferenceLineIntersectionX, surfaceLine.ReferenceLineIntersectionWorldPoint.X);
            Assert.AreEqual(entity.ReferenceLineIntersectionY, surfaceLine.ReferenceLineIntersectionWorldPoint.Y);

            CollectionAssert.AreEqual(points, surfaceLine.Points);

            Assert.IsNull(surfaceLine.SurfaceLevelOutside);
            Assert.IsNull(surfaceLine.DikeToeAtRiver);
            Assert.IsNull(surfaceLine.DikeTopAtPolder);
            Assert.IsNull(surfaceLine.DikeTopAtRiver);
            Assert.IsNull(surfaceLine.ShoulderBaseInside);
            Assert.IsNull(surfaceLine.ShoulderTopInside);
            Assert.IsNull(surfaceLine.DikeToeAtPolder);
            Assert.IsNull(surfaceLine.DitchDikeSide);
            Assert.IsNull(surfaceLine.BottomDitchDikeSide);
            Assert.IsNull(surfaceLine.BottomDitchPolderSide);
            Assert.IsNull(surfaceLine.DitchPolderSide);
            Assert.IsNull(surfaceLine.SurfaceLevelInside);
        }
        public void Read_EntityWithSurfaceLineEntity_ReturnsCalculationScenarioWithInputObjectWithSurfaceLineSet()
        {
            // Setup
            var surfaceLine       = new MacroStabilityInwardsSurfaceLine(string.Empty);
            var surfaceLineEntity = new SurfaceLineEntity();

            var collector = new ReadConversionCollector();

            collector.Read(surfaceLineEntity, surfaceLine);

            MacroStabilityInwardsCalculationEntity entity = CreateValidCalculationEntity();

            entity.SurfaceLineEntity = surfaceLineEntity;

            // Call
            MacroStabilityInwardsCalculationScenario calculation = entity.Read(collector);

            // Assert
            Assert.AreSame(surfaceLine, calculation.InputParameters.SurfaceLine);
        }
        public void Create_CalculationWithAlreadyRegisteredSurfaceLine_ReturnsEntityWithSurfaceLineEntity()
        {
            // Setup
            var surfaceLine = new MacroStabilityInwardsSurfaceLine(string.Empty);
            var scenario    = new MacroStabilityInwardsCalculationScenario
            {
                InputParameters =
                {
                    SurfaceLine = surfaceLine
                }
            };

            var registry          = new PersistenceRegistry();
            var surfaceLineEntity = new SurfaceLineEntity();

            registry.Register(surfaceLineEntity, surfaceLine);

            // Call
            MacroStabilityInwardsCalculationEntity entity = scenario.Create(registry, 0);

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreSame(surfaceLineEntity, entity.SurfaceLineEntity);
        }
예제 #25
0
 private static Point2D GetReferenceLineIntersectionWorldPoint(SurfaceLineEntity entity)
 {
     return(new Point2D(entity.ReferenceLineIntersectionX.ToNullAsNaN(),
                        entity.ReferenceLineIntersectionY.ToNullAsNaN()));
 }
예제 #26
0
 /// <summary>
 /// Registers a create operation for <paramref name="model"/> and the <paramref name="entity"/>
 /// that was constructed with the information.
 /// </summary>
 /// <param name="entity">The <see cref="SurfaceLineEntity"/> to be registered.</param>
 /// <param name="model">The <see cref="MacroStabilityInwardsSurfaceLine"/> to be registered.</param>
 /// <exception cref="ArgumentNullException">Thrown when any of the input parameters is <c>null</c>.</exception>
 internal void Register(SurfaceLineEntity entity, MacroStabilityInwardsSurfaceLine model)
 {
     Register(macroStabilityInwardsSurfaceLines, entity, model);
 }
예제 #27
0
 /// <summary>
 /// Registers a create operation for <paramref name="model"/> and the <paramref name="entity"/>
 /// that was constructed with the information.
 /// </summary>
 /// <param name="entity">The <see cref="SurfaceLineEntity"/> to be registered.</param>
 /// <param name="model">The <see cref="PipingSurfaceLine"/> to be registered.</param>
 /// <exception cref="ArgumentNullException">Thrown when any of the input parameters is <c>null</c>.</exception>
 internal void Register(SurfaceLineEntity entity, PipingSurfaceLine model)
 {
     Register(pipingSurfaceLines, entity, model);
 }
예제 #28
0
 private static void CreateCharacteristicPointEntities(MacroStabilityInwardsSurfaceLine surfaceLine, SurfaceLineEntity entity)
 {
     Tuple <Point3D, MacroStabilityInwardsCharacteristicPointType>[] characteristicPointAssociations =
     {
         Tuple.Create(surfaceLine.SurfaceLevelOutside,   MacroStabilityInwardsCharacteristicPointType.SurfaceLevelOutside),
         Tuple.Create(surfaceLine.DikeTopAtPolder,       MacroStabilityInwardsCharacteristicPointType.DikeTopAtPolder),
         Tuple.Create(surfaceLine.DikeTopAtRiver,        MacroStabilityInwardsCharacteristicPointType.DikeTopAtRiver),
         Tuple.Create(surfaceLine.ShoulderBaseInside,    MacroStabilityInwardsCharacteristicPointType.ShoulderBaseInside),
         Tuple.Create(surfaceLine.ShoulderTopInside,     MacroStabilityInwardsCharacteristicPointType.ShoulderTopInside),
         Tuple.Create(surfaceLine.BottomDitchDikeSide,   MacroStabilityInwardsCharacteristicPointType.BottomDitchDikeSide),
         Tuple.Create(surfaceLine.BottomDitchPolderSide, MacroStabilityInwardsCharacteristicPointType.BottomDitchPolderSide),
         Tuple.Create(surfaceLine.DikeToeAtPolder,       MacroStabilityInwardsCharacteristicPointType.DikeToeAtPolder),
         Tuple.Create(surfaceLine.DikeToeAtRiver,        MacroStabilityInwardsCharacteristicPointType.DikeToeAtRiver),
         Tuple.Create(surfaceLine.DitchDikeSide,         MacroStabilityInwardsCharacteristicPointType.DitchDikeSide),
         Tuple.Create(surfaceLine.DitchPolderSide,       MacroStabilityInwardsCharacteristicPointType.DitchPolderSide),
         Tuple.Create(surfaceLine.SurfaceLevelInside,    MacroStabilityInwardsCharacteristicPointType.SurfaceLevelInside)
     };
     foreach (Tuple <Point3D, MacroStabilityInwardsCharacteristicPointType> characteristicPointToSave in characteristicPointAssociations.Where(t => t.Item1 != null))
     {
         MacroStabilityInwardsCharacteristicPointEntity characteristicPointEntity = CreateCharacteristicPointEntity(characteristicPointToSave.Item1,
                                                                                                                    characteristicPointToSave.Item2);
         entity.MacroStabilityInwardsCharacteristicPointEntities.Add(characteristicPointEntity);
     }
 }
예제 #29
0
        public void Create_SurfaceLineWithGeometryAndCharacteristicPoints_ReturnSurfaceLineEntityWithPointEntitiesAndCharactersisticPointReferences()
        {
            // Setup
            var registry = new PersistenceRegistry();
            var random   = new Random(31);
            var geometry = new[]
            {
                new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble()),
                new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble()),
                new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble()),
                new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble()),
                new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble()),
                new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble()),
                new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble()),
                new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble())
            };
            var surfaceLine = new PipingSurfaceLine("Test")
            {
                ReferenceLineIntersectionWorldPoint = new Point2D(random.NextDouble(), random.NextDouble())
            };

            surfaceLine.SetGeometry(geometry);
            const int bottomDitchDikeIndex = 1;

            surfaceLine.SetBottomDitchDikeSideAt(geometry[bottomDitchDikeIndex]);
            const int bottomDitchPolderIndex = 2;

            surfaceLine.SetBottomDitchPolderSideAt(geometry[bottomDitchPolderIndex]);
            const int toePolderIndex = 3;

            surfaceLine.SetDikeToeAtPolderAt(geometry[toePolderIndex]);
            const int toeDikeIndex = 4;

            surfaceLine.SetDikeToeAtRiverAt(geometry[toeDikeIndex]);
            const int ditchDikeIndex = 5;

            surfaceLine.SetDitchDikeSideAt(geometry[ditchDikeIndex]);
            const int ditchPolderIndex = 6;

            surfaceLine.SetDitchPolderSideAt(geometry[ditchPolderIndex]);

            // Call
            SurfaceLineEntity entity = surfaceLine.Create(registry, 0);

            // Assert
            Assert.AreEqual(surfaceLine.Name, entity.Name);
            Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX);
            Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY);

            string expectedXml = new Point3DCollectionXmlSerializer().ToXml(geometry);

            Assert.AreEqual(expectedXml, entity.PointsXml);

            Assert.AreEqual(6, entity.PipingCharacteristicPointEntities.Count);
            foreach (PipingCharacteristicPointEntity characteristicPointEntity in entity.PipingCharacteristicPointEntities)
            {
                switch (characteristicPointEntity.Type)
                {
                case (byte)PipingCharacteristicPointType.BottomDitchDikeSide:
                    Assert.AreEqual(geometry[bottomDitchDikeIndex].X, characteristicPointEntity.X);
                    Assert.AreEqual(geometry[bottomDitchDikeIndex].Y, characteristicPointEntity.Y);
                    Assert.AreEqual(geometry[bottomDitchDikeIndex].Z, characteristicPointEntity.Z);
                    break;

                case (byte)PipingCharacteristicPointType.BottomDitchPolderSide:
                    Assert.AreEqual(geometry[bottomDitchPolderIndex].X, characteristicPointEntity.X);
                    Assert.AreEqual(geometry[bottomDitchPolderIndex].Y, characteristicPointEntity.Y);
                    Assert.AreEqual(geometry[bottomDitchPolderIndex].Z, characteristicPointEntity.Z);
                    break;

                case (byte)PipingCharacteristicPointType.DikeToeAtPolder:
                    Assert.AreEqual(geometry[toePolderIndex].X, characteristicPointEntity.X);
                    Assert.AreEqual(geometry[toePolderIndex].Y, characteristicPointEntity.Y);
                    Assert.AreEqual(geometry[toePolderIndex].Z, characteristicPointEntity.Z);
                    break;

                case (byte)PipingCharacteristicPointType.DikeToeAtRiver:
                    Assert.AreEqual(geometry[toeDikeIndex].X, characteristicPointEntity.X);
                    Assert.AreEqual(geometry[toeDikeIndex].Y, characteristicPointEntity.Y);
                    Assert.AreEqual(geometry[toeDikeIndex].Z, characteristicPointEntity.Z);
                    break;

                case (byte)PipingCharacteristicPointType.DitchDikeSide:
                    Assert.AreEqual(geometry[ditchDikeIndex].X, characteristicPointEntity.X);
                    Assert.AreEqual(geometry[ditchDikeIndex].Y, characteristicPointEntity.Y);
                    Assert.AreEqual(geometry[ditchDikeIndex].Z, characteristicPointEntity.Z);
                    break;

                case (byte)PipingCharacteristicPointType.DitchPolderSide:
                    Assert.AreEqual(geometry[ditchPolderIndex].X, characteristicPointEntity.X);
                    Assert.AreEqual(geometry[ditchPolderIndex].Y, characteristicPointEntity.Y);
                    Assert.AreEqual(geometry[ditchPolderIndex].Z, characteristicPointEntity.Z);
                    break;

                default:
                    Assert.Fail("Invalid characteristic point type found: {0}", characteristicPointEntity.Type);
                    break;
                }
            }
        }
예제 #30
0
 private static void CreateCharacteristicPointEntities(PipingSurfaceLine surfaceLine, SurfaceLineEntity entity)
 {
     Tuple <Point3D, PipingCharacteristicPointType>[] characteristicPointAssociations =
     {
         Tuple.Create(surfaceLine.BottomDitchPolderSide, PipingCharacteristicPointType.BottomDitchPolderSide),
         Tuple.Create(surfaceLine.BottomDitchDikeSide,   PipingCharacteristicPointType.BottomDitchDikeSide),
         Tuple.Create(surfaceLine.DikeToeAtPolder,       PipingCharacteristicPointType.DikeToeAtPolder),
         Tuple.Create(surfaceLine.DikeToeAtRiver,        PipingCharacteristicPointType.DikeToeAtRiver),
         Tuple.Create(surfaceLine.DitchDikeSide,         PipingCharacteristicPointType.DitchDikeSide),
         Tuple.Create(surfaceLine.DitchPolderSide,       PipingCharacteristicPointType.DitchPolderSide)
     };
     foreach (Tuple <Point3D, PipingCharacteristicPointType> characteristicPointToSave in characteristicPointAssociations.Where(t => t.Item1 != null))
     {
         PipingCharacteristicPointEntity characteristicPointEntity = CreateCharacteristicPointEntity(characteristicPointToSave.Item1,
                                                                                                     characteristicPointToSave.Item2);
         entity.PipingCharacteristicPointEntities.Add(characteristicPointEntity);
     }
 }