コード例 #1
0
        /// <summary>
        /// Returns a collection of modified <see cref="HeightStructure"/> 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(HeightStructurePermutationHelper),
        ///     nameof(HeightStructurePermutationHelper.DifferentHeightStructuresWithSameId),
        ///     new object[]
        ///     {
        ///         "TargetMethodName",
        ///         "TestResult"
        ///     })]
        /// </code>
        /// </example>
        public static IEnumerable <TestCaseData> DifferentHeightStructuresWithSameId(string targetName, string testResultDescription)
        {
            string referenceStructureId = new TestHeightStructure().Id;

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

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

            return(testCaseData);
        }
コード例 #2
0
        private static HeightStructure.ConstructionProperties CreateTestHeightStructureConstructionProperties()
        {
            var referenceStructure = new TestHeightStructure();

            return(new HeightStructure.ConstructionProperties
            {
                Name = referenceStructure.Name,
                Id = referenceStructure.Id,
                Location = referenceStructure.Location,
                AllowedLevelIncreaseStorage =
                {
                    Mean              = referenceStructure.AllowedLevelIncreaseStorage.Mean,
                    StandardDeviation = referenceStructure.AllowedLevelIncreaseStorage.StandardDeviation
                },
                CriticalOvertoppingDischarge =
                {
                    Mean                   = referenceStructure.CriticalOvertoppingDischarge.Mean,
                    CoefficientOfVariation = referenceStructure.CriticalOvertoppingDischarge.CoefficientOfVariation
                },
                FlowWidthAtBottomProtection =
                {
                    Mean              = referenceStructure.FlowWidthAtBottomProtection.Mean,
                    StandardDeviation = referenceStructure.FlowWidthAtBottomProtection.StandardDeviation
                },
                LevelCrestStructure =
                {
                    Mean              = referenceStructure.LevelCrestStructure.Mean,
                    StandardDeviation = referenceStructure.LevelCrestStructure.StandardDeviation
                },
                StorageStructureArea =
                {
                    Mean                   = referenceStructure.StorageStructureArea.Mean,
                    CoefficientOfVariation = referenceStructure.StorageStructureArea.CoefficientOfVariation
                },
                WidthFlowApertures =
                {
                    Mean              = referenceStructure.WidthFlowApertures.Mean,
                    StandardDeviation = referenceStructure.WidthFlowApertures.StandardDeviation
                },
                FailureProbabilityStructureWithErosion = referenceStructure.FailureProbabilityStructureWithErosion,
                StructureNormalOrientation = referenceStructure.StructureNormalOrientation
            });
        }