Ejemplo n.º 1
0
        /// <summary>
        /// Returns a collection of modified <see cref="ClosingStructure"/> entities, which all differ
        /// except for their id.
        /// </summary>
        /// <param name="targetName">The name of the target to test while using the test case source.</param>
        /// <param name="testResultDescription">A description of the result of the test while using the test case source.</param>
        /// <returns>The collection of test case data.</returns>
        /// <example>
        /// <code>
        /// [TestCaseSource(
        ///     typeof(ClosingStructurePermutationHelper),
        ///     nameof(ClosingStructurePermutationHelper.DifferentClosingStructuresWithSameId),
        ///     new object[]
        ///     {
        ///         "TargetMethodName",
        ///         "TestResult"
        ///     })]
        /// </code>
        /// </example>
        public static IEnumerable <TestCaseData> DifferentClosingStructuresWithSameId(string targetName, string testResultDescription)
        {
            string referenceStructureId = new TestClosingStructure().Id;

            var testCaseData = new List <TestCaseData>
            {
                new TestCaseData(new TestClosingStructure(referenceStructureId, "Different name"))
                .SetName($"{targetName}_DifferentName_{testResultDescription}"),
                new TestCaseData(new TestClosingStructure(new Point2D(1, 1), referenceStructureId))
                .SetName($"{targetName}_DifferentLocation_{testResultDescription}")
            };

            testCaseData.AddRange(DifferentClosingStructuresWithSameIdNameAndLocation(targetName, testResultDescription));

            return(testCaseData);
        }
Ejemplo n.º 2
0
        private static ClosingStructure.ConstructionProperties CreateTestClosingStructureConstructionProperties()
        {
            var referenceStructure = new TestClosingStructure();

            return(new ClosingStructure.ConstructionProperties
            {
                Name = referenceStructure.Name,
                Id = referenceStructure.Id,
                Location = referenceStructure.Location,
                AllowedLevelIncreaseStorage =
                {
                    Mean              = referenceStructure.AllowedLevelIncreaseStorage.Mean,
                    StandardDeviation = referenceStructure.AllowedLevelIncreaseStorage.StandardDeviation
                },
                AreaFlowApertures =
                {
                    Mean              = referenceStructure.AreaFlowApertures.Mean,
                    StandardDeviation = referenceStructure.AreaFlowApertures.StandardDeviation
                },
                CriticalOvertoppingDischarge =
                {
                    Mean                   = referenceStructure.CriticalOvertoppingDischarge.Mean,
                    CoefficientOfVariation = referenceStructure.CriticalOvertoppingDischarge.CoefficientOfVariation
                },
                FlowWidthAtBottomProtection =
                {
                    Mean              = referenceStructure.FlowWidthAtBottomProtection.Mean,
                    StandardDeviation = referenceStructure.FlowWidthAtBottomProtection.StandardDeviation
                },
                InsideWaterLevel =
                {
                    Mean              = referenceStructure.InsideWaterLevel.Mean,
                    StandardDeviation = referenceStructure.InsideWaterLevel.StandardDeviation
                },
                LevelCrestStructureNotClosing =
                {
                    Mean              = referenceStructure.LevelCrestStructureNotClosing.Mean,
                    StandardDeviation = referenceStructure.LevelCrestStructureNotClosing.StandardDeviation
                },
                StorageStructureArea =
                {
                    Mean                   = referenceStructure.StorageStructureArea.Mean,
                    CoefficientOfVariation = referenceStructure.StorageStructureArea.CoefficientOfVariation
                },
                ThresholdHeightOpenWeir =
                {
                    Mean              = referenceStructure.ThresholdHeightOpenWeir.Mean,
                    StandardDeviation = referenceStructure.ThresholdHeightOpenWeir.StandardDeviation
                },
                WidthFlowApertures =
                {
                    Mean              = referenceStructure.WidthFlowApertures.Mean,
                    StandardDeviation = referenceStructure.WidthFlowApertures.StandardDeviation
                },
                FailureProbabilityReparation = referenceStructure.FailureProbabilityReparation,
                FailureProbabilityOpenStructure = referenceStructure.FailureProbabilityOpenStructure,
                IdenticalApertures = referenceStructure.IdenticalApertures,
                InflowModelType = referenceStructure.InflowModelType,
                ProbabilityOpenStructureBeforeFlooding = referenceStructure.ProbabilityOpenStructureBeforeFlooding,
                StructureNormalOrientation = referenceStructure.StructureNormalOrientation
            });
        }