コード例 #1
0
 private static void AddEntitiesForClosingStructures(
     StructureCollection <ClosingStructure> structures,
     FailureMechanismEntity entity,
     PersistenceRegistry registry)
 {
     for (var i = 0; i < structures.Count; i++)
     {
         ClosingStructureEntity structureEntity = structures[i].Create(registry, i);
         entity.ClosingStructureEntities.Add(structureEntity);
     }
 }
コード例 #2
0
        public void Read_ReadConversionCollectorNull_ThrowArgumentNullException()
        {
            // Setup
            var entity = new ClosingStructureEntity();

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

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

            Assert.AreEqual("collector", paramName);
        }
コード例 #3
0
        /// <summary>
        /// Creates a <see cref="ClosingStructureEntity"/> based on the information of the <see cref="ClosingStructure"/>.
        /// </summary>
        /// <param name="structure">The structure 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="structure"/> resides within its parent.</param>
        /// <returns>A new <see cref="ClosingStructureEntity"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="registry"/> is <c>null</c>.</exception>
        internal static ClosingStructureEntity Create(this ClosingStructure structure, PersistenceRegistry registry, int order)
        {
            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

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

            var entity = new ClosingStructureEntity
            {
                Name = structure.Name.DeepClone(),
                Id   = structure.Id.DeepClone(),
                X    = structure.Location.X.ToNaNAsNull(),
                Y    = structure.Location.Y.ToNaNAsNull(),
                StructureNormalOrientation = structure.StructureNormalOrientation.ToNaNAsNull(),
                StorageStructureAreaMean   = structure.StorageStructureArea.Mean.ToNaNAsNull(),
                StorageStructureAreaCoefficientOfVariation   = structure.StorageStructureArea.CoefficientOfVariation.ToNaNAsNull(),
                AllowedLevelIncreaseStorageMean              = structure.AllowedLevelIncreaseStorage.Mean.ToNaNAsNull(),
                AllowedLevelIncreaseStorageStandardDeviation = structure.AllowedLevelIncreaseStorage.StandardDeviation.ToNaNAsNull(),
                WidthFlowAperturesMean = structure.WidthFlowApertures.Mean.ToNaNAsNull(),
                WidthFlowAperturesStandardDeviation            = structure.WidthFlowApertures.StandardDeviation.ToNaNAsNull(),
                LevelCrestStructureNotClosingMean              = structure.LevelCrestStructureNotClosing.Mean.ToNaNAsNull(),
                LevelCrestStructureNotClosingStandardDeviation = structure.LevelCrestStructureNotClosing.StandardDeviation.ToNaNAsNull(),
                InsideWaterLevelMean = structure.InsideWaterLevel.Mean.ToNaNAsNull(),
                InsideWaterLevelStandardDeviation        = structure.InsideWaterLevel.StandardDeviation.ToNaNAsNull(),
                ThresholdHeightOpenWeirMean              = structure.ThresholdHeightOpenWeir.Mean.ToNaNAsNull(),
                ThresholdHeightOpenWeirStandardDeviation = structure.ThresholdHeightOpenWeir.StandardDeviation.ToNaNAsNull(),
                AreaFlowAperturesMean = structure.AreaFlowApertures.Mean.ToNaNAsNull(),
                AreaFlowAperturesStandardDeviation = structure.AreaFlowApertures.StandardDeviation.ToNaNAsNull(),
                CriticalOvertoppingDischargeMean   = structure.CriticalOvertoppingDischarge.Mean.ToNaNAsNull(),
                CriticalOvertoppingDischargeCoefficientOfVariation = structure.CriticalOvertoppingDischarge.CoefficientOfVariation.ToNaNAsNull(),
                FlowWidthAtBottomProtectionMean = structure.FlowWidthAtBottomProtection.Mean.ToNaNAsNull(),
                FlowWidthAtBottomProtectionStandardDeviation = structure.FlowWidthAtBottomProtection.StandardDeviation.ToNaNAsNull(),
                ProbabilityOpenStructureBeforeFlooding       = structure.ProbabilityOpenStructureBeforeFlooding.ToNaNAsNull(),
                FailureProbabilityOpenStructure = structure.FailureProbabilityOpenStructure.ToNaNAsNull(),
                IdenticalApertures           = structure.IdenticalApertures,
                FailureProbabilityReparation = structure.FailureProbabilityReparation.ToNaNAsNull(),
                InflowModelType = Convert.ToByte(structure.InflowModelType),
                Order           = order
            };

            registry.Register(entity, structure);

            return(entity);
        }
コード例 #4
0
        public void Read_EntityRegistered_ReturnRegisteredStructure()
        {
            // Setup
            var entity = new ClosingStructureEntity();
            ClosingStructure registeredStructure = new TestClosingStructure();
            var collector = new ReadConversionCollector();

            collector.Read(entity, registeredStructure);

            // Call
            ClosingStructure readStructure = entity.Read(collector);

            // Assert
            Assert.AreSame(registeredStructure, readStructure);
        }
コード例 #5
0
        public void Create_StructureAlreadyRegistered_ReturnRegisteredEntity()
        {
            // Setup
            ClosingStructure structure = new TestClosingStructure();

            var registeredEntity = new ClosingStructureEntity();
            var registry         = new PersistenceRegistry();

            registry.Register(registeredEntity, structure);

            // Call
            ClosingStructureEntity entity = structure.Create(registry, 0);

            // Assert
            Assert.AreSame(registeredEntity, entity);
        }
コード例 #6
0
        public void Create_ValidStructure_ReturnEntity()
        {
            // Setup
            ClosingStructure structure = new TestClosingStructure();
            var registry = new PersistenceRegistry();

            const int order = 4;

            // Call
            ClosingStructureEntity entity = structure.Create(registry, order);

            // Assert
            Assert.AreEqual(structure.Name, entity.Name);
            Assert.AreNotSame(structure.Name, entity.Name);
            Assert.AreEqual(structure.Id, entity.Id);
            Assert.AreNotSame(structure.Id, entity.Id);
            Assert.AreEqual(structure.Location.X, entity.X);
            Assert.AreEqual(structure.Location.Y, entity.Y);
            Assert.AreEqual(structure.StructureNormalOrientation.Value, entity.StructureNormalOrientation);

            Assert.AreEqual(structure.StorageStructureArea.Mean.Value, entity.StorageStructureAreaMean);
            Assert.AreEqual(structure.StorageStructureArea.CoefficientOfVariation.Value, entity.StorageStructureAreaCoefficientOfVariation);
            Assert.AreEqual(structure.AllowedLevelIncreaseStorage.Mean.Value, entity.AllowedLevelIncreaseStorageMean);
            Assert.AreEqual(structure.AllowedLevelIncreaseStorage.StandardDeviation.Value, entity.AllowedLevelIncreaseStorageStandardDeviation);
            Assert.AreEqual(structure.WidthFlowApertures.Mean.Value, entity.WidthFlowAperturesMean);
            Assert.AreEqual(structure.WidthFlowApertures.StandardDeviation.Value, entity.WidthFlowAperturesStandardDeviation);
            Assert.AreEqual(structure.LevelCrestStructureNotClosing.Mean.Value, entity.LevelCrestStructureNotClosingMean);
            Assert.AreEqual(structure.LevelCrestStructureNotClosing.StandardDeviation.Value, entity.LevelCrestStructureNotClosingStandardDeviation);
            Assert.AreEqual(structure.InsideWaterLevel.Mean.Value, entity.InsideWaterLevelMean);
            Assert.AreEqual(structure.InsideWaterLevel.StandardDeviation.Value, entity.InsideWaterLevelStandardDeviation);
            Assert.AreEqual(structure.ThresholdHeightOpenWeir.Mean.Value, entity.ThresholdHeightOpenWeirMean);
            Assert.AreEqual(structure.ThresholdHeightOpenWeir.StandardDeviation.Value, entity.ThresholdHeightOpenWeirStandardDeviation);
            Assert.AreEqual(structure.AreaFlowApertures.Mean.Value, entity.AreaFlowAperturesMean);
            Assert.AreEqual(structure.AreaFlowApertures.StandardDeviation.Value, entity.AreaFlowAperturesStandardDeviation);
            Assert.AreEqual(structure.CriticalOvertoppingDischarge.Mean.Value, entity.CriticalOvertoppingDischargeMean);
            Assert.AreEqual(structure.CriticalOvertoppingDischarge.CoefficientOfVariation.Value, entity.CriticalOvertoppingDischargeCoefficientOfVariation);
            Assert.AreEqual(structure.FlowWidthAtBottomProtection.Mean.Value, entity.FlowWidthAtBottomProtectionMean);
            Assert.AreEqual(structure.FlowWidthAtBottomProtection.StandardDeviation.Value, entity.FlowWidthAtBottomProtectionStandardDeviation);
            Assert.AreEqual(structure.ProbabilityOpenStructureBeforeFlooding, entity.ProbabilityOpenStructureBeforeFlooding);
            Assert.AreEqual(structure.FailureProbabilityOpenStructure, entity.FailureProbabilityOpenStructure);
            Assert.AreEqual(structure.IdenticalApertures, entity.IdenticalApertures);
            Assert.AreEqual(structure.FailureProbabilityReparation, entity.FailureProbabilityReparation);
            Assert.AreEqual(Convert.ToByte(structure.InflowModelType), entity.InflowModelType);
            Assert.AreEqual(order, entity.Order);

            Assert.IsTrue(registry.Contains(structure));
        }
コード例 #7
0
        public void Read_EntityNotReadBefore_RegisterEntity()
        {
            // Setup
            var entity = new ClosingStructureEntity
            {
                Name = "name",
                Id   = "id"
            };

            var collector = new ReadConversionCollector();

            // Precondition
            Assert.IsFalse(collector.Contains(entity));

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

            // Assert
            Assert.IsTrue(collector.Contains(entity));
            Assert.AreSame(calculation, collector.Get(entity));
        }
コード例 #8
0
        public void Read_EntityWithStructureEntity_ReturnCalculationWithStructure()
        {
            // Setup
            ClosingStructure structure = new TestClosingStructure();
            var structureEntity        = new ClosingStructureEntity();
            var entity = new ClosingStructuresCalculationEntity
            {
                ClosingStructureEntity = structureEntity,
                IdenticalApertures     = 1,
                ScenarioContribution   = 0
            };
            var collector = new ReadConversionCollector();

            collector.Read(structureEntity, structure);

            // Call
            StructuresCalculationScenario <ClosingStructuresInput> calculation = entity.Read(collector);

            // Assert
            Assert.AreSame(structure, calculation.InputParameters.Structure);
        }
コード例 #9
0
        public void Create_NaNValue_ReturnEntityWithNullValue()
        {
            // Setup
            var structure = new ClosingStructure(new ClosingStructure.ConstructionProperties
            {
                Name     = "A",
                Id       = "B",
                Location = new Point2D(double.NaN, double.NaN),
                StructureNormalOrientation = RoundedDouble.NaN,
                StorageStructureArea       =
                {
                    Mean                   = RoundedDouble.NaN,
                    CoefficientOfVariation = RoundedDouble.NaN
                },
                AllowedLevelIncreaseStorage =
                {
                    Mean              = RoundedDouble.NaN,
                    StandardDeviation = RoundedDouble.NaN
                },
                WidthFlowApertures =
                {
                    Mean              = RoundedDouble.NaN,
                    StandardDeviation = RoundedDouble.NaN
                },
                LevelCrestStructureNotClosing =
                {
                    Mean              = RoundedDouble.NaN,
                    StandardDeviation = RoundedDouble.NaN
                },
                InsideWaterLevel =
                {
                    Mean              = RoundedDouble.NaN,
                    StandardDeviation = RoundedDouble.NaN
                },
                ThresholdHeightOpenWeir =
                {
                    Mean              = RoundedDouble.NaN,
                    StandardDeviation = RoundedDouble.NaN
                },
                AreaFlowApertures =
                {
                    Mean              = RoundedDouble.NaN,
                    StandardDeviation = RoundedDouble.NaN
                },
                CriticalOvertoppingDischarge =
                {
                    Mean                   = RoundedDouble.NaN,
                    CoefficientOfVariation = RoundedDouble.NaN
                },
                FlowWidthAtBottomProtection =
                {
                    Mean              = RoundedDouble.NaN,
                    StandardDeviation = RoundedDouble.NaN
                },
                ProbabilityOpenStructureBeforeFlooding = double.NaN,
                FailureProbabilityOpenStructure        = double.NaN,
                FailureProbabilityReparation           = double.NaN
            });
            var registry = new PersistenceRegistry();

            // Call
            ClosingStructureEntity entity = structure.Create(registry, 0);

            // Assert
            Assert.IsNull(entity.X);
            Assert.IsNull(entity.Y);
            Assert.IsNull(entity.StructureNormalOrientation);
            Assert.IsNull(entity.StorageStructureAreaMean);
            Assert.IsNull(entity.StorageStructureAreaCoefficientOfVariation);
            Assert.IsNull(entity.AllowedLevelIncreaseStorageMean);
            Assert.IsNull(entity.AllowedLevelIncreaseStorageStandardDeviation);
            Assert.IsNull(entity.WidthFlowAperturesMean);
            Assert.IsNull(entity.WidthFlowAperturesStandardDeviation);
            Assert.IsNull(entity.LevelCrestStructureNotClosingMean);
            Assert.IsNull(entity.LevelCrestStructureNotClosingStandardDeviation);
            Assert.IsNull(entity.InsideWaterLevelMean);
            Assert.IsNull(entity.InsideWaterLevelStandardDeviation);
            Assert.IsNull(entity.ThresholdHeightOpenWeirMean);
            Assert.IsNull(entity.ThresholdHeightOpenWeirStandardDeviation);
            Assert.IsNull(entity.AreaFlowAperturesMean);
            Assert.IsNull(entity.AreaFlowAperturesStandardDeviation);
            Assert.IsNull(entity.CriticalOvertoppingDischargeMean);
            Assert.IsNull(entity.CriticalOvertoppingDischargeCoefficientOfVariation);
            Assert.IsNull(entity.FlowWidthAtBottomProtectionMean);
            Assert.IsNull(entity.FlowWidthAtBottomProtectionStandardDeviation);
            Assert.IsNull(entity.ProbabilityOpenStructureBeforeFlooding);
            Assert.IsNull(entity.FailureProbabilityOpenStructure);
            Assert.IsNull(entity.FailureProbabilityReparation);
        }
コード例 #10
0
        /// <summary>
        /// Reads the <see cref="ClosingStructureEntity"/> and use the information to update a
        /// <see cref="ClosingStructure"/>.
        /// </summary>
        /// <param name="entity">The <see cref="ClosingStructureEntity"/> to create <see cref="ClosingStructure"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="ClosingStructure"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="collector"/> is <c>null</c>.</exception>
        internal static ClosingStructure Read(this ClosingStructureEntity entity, ReadConversionCollector collector)
        {
            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            var structure = new ClosingStructure(new ClosingStructure.ConstructionProperties
            {
                Name     = entity.Name,
                Id       = entity.Id,
                Location = new Point2D(entity.X.ToNullAsNaN(), entity.Y.ToNullAsNaN()),
                StructureNormalOrientation = (RoundedDouble)entity.StructureNormalOrientation.ToNullAsNaN(),
                StorageStructureArea       =
                {
                    Mean                   = (RoundedDouble)entity.StorageStructureAreaMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.StorageStructureAreaCoefficientOfVariation.ToNullAsNaN()
                },
                AllowedLevelIncreaseStorage =
                {
                    Mean              = (RoundedDouble)entity.AllowedLevelIncreaseStorageMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.AllowedLevelIncreaseStorageStandardDeviation.ToNullAsNaN()
                },
                WidthFlowApertures =
                {
                    Mean              = (RoundedDouble)entity.WidthFlowAperturesMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.WidthFlowAperturesStandardDeviation.ToNullAsNaN()
                },
                LevelCrestStructureNotClosing =
                {
                    Mean              = (RoundedDouble)entity.LevelCrestStructureNotClosingMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.LevelCrestStructureNotClosingStandardDeviation.ToNullAsNaN()
                },
                InsideWaterLevel =
                {
                    Mean              = (RoundedDouble)entity.InsideWaterLevelMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.InsideWaterLevelStandardDeviation.ToNullAsNaN()
                },
                ThresholdHeightOpenWeir =
                {
                    Mean              = (RoundedDouble)entity.ThresholdHeightOpenWeirMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.ThresholdHeightOpenWeirStandardDeviation.ToNullAsNaN()
                },
                AreaFlowApertures =
                {
                    Mean              = (RoundedDouble)entity.AreaFlowAperturesMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.AreaFlowAperturesStandardDeviation.ToNullAsNaN()
                },
                CriticalOvertoppingDischarge =
                {
                    Mean                   = (RoundedDouble)entity.CriticalOvertoppingDischargeMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.CriticalOvertoppingDischargeCoefficientOfVariation.ToNullAsNaN()
                },
                FlowWidthAtBottomProtection =
                {
                    Mean              = (RoundedDouble)entity.FlowWidthAtBottomProtectionMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.FlowWidthAtBottomProtectionStandardDeviation.ToNullAsNaN()
                },
                ProbabilityOpenStructureBeforeFlooding = entity.ProbabilityOpenStructureBeforeFlooding.ToNullAsNaN(),
                FailureProbabilityOpenStructure        = entity.FailureProbabilityOpenStructure.ToNullAsNaN(),
                IdenticalApertures           = entity.IdenticalApertures,
                FailureProbabilityReparation = entity.FailureProbabilityReparation.ToNullAsNaN(),
                InflowModelType = (ClosingStructureInflowModelType)entity.InflowModelType
            });

            collector.Read(entity, structure);

            return(structure);
        }
コード例 #11
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="ClosingStructureEntity"/> to be registered.</param>
 /// <param name="model">The <see cref="ClosingStructure"/> to be registered.</param>
 /// <exception cref="ArgumentNullException">Thrown when any of the input parameters is <c>null</c>.</exception>
 internal void Register(ClosingStructureEntity entity, ClosingStructure model)
 {
     Register(closingStructures, entity, model);
 }
コード例 #12
0
        public void Read_ValidEntity_ReturnClosingStructure()
        {
            // Setup
            var entity = new ClosingStructureEntity
            {
                Name = "A",
                Id   = "B",
                X    = 1.1,
                Y    = 2.2,
                StructureNormalOrientation = 3.3,
                StorageStructureAreaMean   = 4.4,
                StorageStructureAreaCoefficientOfVariation   = 5.5,
                AllowedLevelIncreaseStorageMean              = 6.6,
                AllowedLevelIncreaseStorageStandardDeviation = 7.7,
                WidthFlowAperturesMean = 8.8,
                WidthFlowAperturesStandardDeviation            = 9.9,
                LevelCrestStructureNotClosingMean              = 10.10,
                LevelCrestStructureNotClosingStandardDeviation = 11.11,
                InsideWaterLevelMean = 12.12,
                InsideWaterLevelStandardDeviation        = 13.13,
                ThresholdHeightOpenWeirMean              = 14.14,
                ThresholdHeightOpenWeirStandardDeviation = 15.15,
                AreaFlowAperturesMean = 16.16,
                AreaFlowAperturesStandardDeviation = 17.17,
                CriticalOvertoppingDischargeMean   = 18.18,
                CriticalOvertoppingDischargeCoefficientOfVariation = 19.19,
                FlowWidthAtBottomProtectionMean = 20.20,
                FlowWidthAtBottomProtectionStandardDeviation = 21.21,
                ProbabilityOpenStructureBeforeFlooding       = 22.22,
                FailureProbabilityOpenStructure = 23.23,
                IdenticalApertures           = 24,
                FailureProbabilityReparation = 25.25,
                InflowModelType = Convert.ToByte(ClosingStructureInflowModelType.FloodedCulvert)
            };

            var collector = new ReadConversionCollector();

            // Call
            ClosingStructure structure = entity.Read(collector);

            // Assert
            Assert.AreEqual(entity.Name, structure.Name);
            Assert.AreEqual(entity.Id, structure.Id);
            Assert.AreEqual(entity.X, structure.Location.X);
            Assert.AreEqual(entity.Y, structure.Location.Y);
            Assert.AreEqual(entity.StructureNormalOrientation, structure.StructureNormalOrientation.Value);
            Assert.AreEqual(entity.StorageStructureAreaMean, structure.StorageStructureArea.Mean.Value);
            Assert.AreEqual(entity.StorageStructureAreaCoefficientOfVariation, structure.StorageStructureArea.CoefficientOfVariation.Value);
            Assert.AreEqual(entity.AllowedLevelIncreaseStorageMean, structure.AllowedLevelIncreaseStorage.Mean.Value);
            Assert.AreEqual(entity.AllowedLevelIncreaseStorageStandardDeviation, structure.AllowedLevelIncreaseStorage.StandardDeviation.Value);
            Assert.AreEqual(entity.WidthFlowAperturesMean, structure.WidthFlowApertures.Mean.Value);
            Assert.AreEqual(entity.WidthFlowAperturesStandardDeviation, structure.WidthFlowApertures.StandardDeviation.Value);
            Assert.AreEqual(entity.LevelCrestStructureNotClosingMean, structure.LevelCrestStructureNotClosing.Mean.Value);
            Assert.AreEqual(entity.LevelCrestStructureNotClosingStandardDeviation, structure.LevelCrestStructureNotClosing.StandardDeviation.Value);
            Assert.AreEqual(entity.InsideWaterLevelMean, structure.InsideWaterLevel.Mean.Value);
            Assert.AreEqual(entity.InsideWaterLevelStandardDeviation, structure.InsideWaterLevel.StandardDeviation.Value);
            Assert.AreEqual(entity.ThresholdHeightOpenWeirMean, structure.ThresholdHeightOpenWeir.Mean.Value);
            Assert.AreEqual(entity.ThresholdHeightOpenWeirStandardDeviation, structure.ThresholdHeightOpenWeir.StandardDeviation.Value);
            Assert.AreEqual(entity.AreaFlowAperturesMean, structure.AreaFlowApertures.Mean.Value);
            Assert.AreEqual(entity.AreaFlowAperturesStandardDeviation, structure.AreaFlowApertures.StandardDeviation.Value);
            Assert.AreEqual(entity.CriticalOvertoppingDischargeMean, structure.CriticalOvertoppingDischarge.Mean.Value);
            Assert.AreEqual(entity.CriticalOvertoppingDischargeCoefficientOfVariation, structure.CriticalOvertoppingDischarge.CoefficientOfVariation.Value);
            Assert.AreEqual(entity.FlowWidthAtBottomProtectionMean, structure.FlowWidthAtBottomProtection.Mean.Value);
            Assert.AreEqual(entity.FlowWidthAtBottomProtectionStandardDeviation, structure.FlowWidthAtBottomProtection.StandardDeviation.Value);
            Assert.AreEqual(entity.ProbabilityOpenStructureBeforeFlooding, structure.ProbabilityOpenStructureBeforeFlooding);
            Assert.AreEqual(entity.FailureProbabilityOpenStructure, structure.FailureProbabilityOpenStructure);
            Assert.AreEqual(entity.IdenticalApertures, structure.IdenticalApertures);
            Assert.AreEqual(entity.FailureProbabilityReparation, structure.FailureProbabilityReparation);
            Assert.AreEqual((ClosingStructureInflowModelType)entity.InflowModelType, structure.InflowModelType);

            Assert.IsTrue(collector.Contains(entity));
        }
コード例 #13
0
        public void Read_NullValues_ReturnClosingStructureWithNaN()
        {
            // Setup
            var entity = new ClosingStructureEntity
            {
                Name = "A",
                Id   = "B",
                X    = null,
                Y    = null,
                StructureNormalOrientation = null,
                StorageStructureAreaMean   = null,
                StorageStructureAreaCoefficientOfVariation   = null,
                AllowedLevelIncreaseStorageMean              = null,
                AllowedLevelIncreaseStorageStandardDeviation = null,
                WidthFlowAperturesMean = null,
                WidthFlowAperturesStandardDeviation            = null,
                LevelCrestStructureNotClosingMean              = null,
                LevelCrestStructureNotClosingStandardDeviation = null,
                InsideWaterLevelMean = null,
                InsideWaterLevelStandardDeviation        = null,
                ThresholdHeightOpenWeirMean              = null,
                ThresholdHeightOpenWeirStandardDeviation = null,
                AreaFlowAperturesMean = null,
                AreaFlowAperturesStandardDeviation = null,
                CriticalOvertoppingDischargeMean   = null,
                CriticalOvertoppingDischargeCoefficientOfVariation = null,
                FlowWidthAtBottomProtectionMean = null,
                FlowWidthAtBottomProtectionStandardDeviation = null,
                ProbabilityOpenStructureBeforeFlooding       = null,
                FailureProbabilityOpenStructure = null
            };

            var collector = new ReadConversionCollector();

            // Call
            ClosingStructure structure = entity.Read(collector);

            // Assert
            Assert.IsNaN(structure.Location.X);
            Assert.IsNaN(structure.Location.Y);
            Assert.IsNaN(structure.StructureNormalOrientation);

            Assert.IsNaN(structure.StorageStructureArea.Mean);
            Assert.IsNaN(structure.StorageStructureArea.CoefficientOfVariation);
            Assert.IsNaN(structure.AllowedLevelIncreaseStorage.Mean);
            Assert.IsNaN(structure.AllowedLevelIncreaseStorage.StandardDeviation);
            Assert.IsNaN(structure.WidthFlowApertures.Mean);
            Assert.IsNaN(structure.WidthFlowApertures.StandardDeviation);
            Assert.IsNaN(structure.LevelCrestStructureNotClosing.Mean);
            Assert.IsNaN(structure.LevelCrestStructureNotClosing.StandardDeviation);
            Assert.IsNaN(structure.InsideWaterLevel.Mean);
            Assert.IsNaN(structure.InsideWaterLevel.StandardDeviation);
            Assert.IsNaN(structure.ThresholdHeightOpenWeir.Mean);
            Assert.IsNaN(structure.ThresholdHeightOpenWeir.StandardDeviation);
            Assert.IsNaN(structure.AreaFlowApertures.Mean);
            Assert.IsNaN(structure.AreaFlowApertures.StandardDeviation);
            Assert.IsNaN(structure.CriticalOvertoppingDischarge.Mean);
            Assert.IsNaN(structure.CriticalOvertoppingDischarge.CoefficientOfVariation);
            Assert.IsNaN(structure.FlowWidthAtBottomProtection.Mean);
            Assert.IsNaN(structure.FlowWidthAtBottomProtection.StandardDeviation);
            Assert.IsNaN(structure.ProbabilityOpenStructureBeforeFlooding);
            Assert.IsNaN(structure.FailureProbabilityOpenStructure);
            Assert.IsNaN(structure.FailureProbabilityReparation);
        }