コード例 #1
0
        /// <summary>
        /// Returns a collection of modified <see cref="ForeshoreProfile"/> entities, which all differ
        /// except for their id, name, and X0.
        /// </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(ForeshoreProfilePermutationHelper),
        ///     nameof(ForeshoreProfilePermutationHelper.DifferentForeshoreProfilesWithSameIdNameAndX0),
        ///     new object[]
        ///     {
        ///         "TargetMethodName",
        ///         "TestResult"
        ///     })]
        /// </code>
        /// </example>
        public static IEnumerable <TestCaseData> DifferentForeshoreProfilesWithSameIdNameAndX0(string targetName, string testResultDescription)
        {
            var random = new Random(532);

            var referenceProfile = new TestForeshoreProfile();
            var testCaseData     = new List <TestCaseData>
            {
                new TestCaseData(
                    new ForeshoreProfile(
                        referenceProfile.WorldReferencePoint,
                        referenceProfile.Geometry,
                        referenceProfile.BreakWater,
                        new ForeshoreProfile.ConstructionProperties
                {
                    Name        = referenceProfile.Name,
                    Id          = referenceProfile.Id,
                    X0          = referenceProfile.X0,
                    Orientation = random.NextDouble()
                }))
                .SetName($"{targetName}_differentOrientationProfileConstructionProperties_{testResultDescription}")
            };

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

            return(testCaseData);
        }
コード例 #2
0
        /// <summary>
        /// Modifies <see cref="BreakWater"/> properties of the current instance
        /// of the foreshore profile to different values.
        /// </summary>
        /// <param name="foreshoreProfile">The current instance of which the properties
        /// need to be modified.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="foreshoreProfile"/>
        /// is <c>null</c>.</exception>
        public static void ChangeBreakWaterProperties(TestForeshoreProfile foreshoreProfile)
        {
            if (foreshoreProfile == null)
            {
                throw new ArgumentNullException(nameof(foreshoreProfile));
            }

            BreakWater differentBreakWater = null;

            if (!foreshoreProfile.HasBreakWater)
            {
                differentBreakWater = new BreakWater(BreakWaterType.Caisson, 12.34);
            }

            var foreshoreProfileToUpdateFrom = new TestForeshoreProfile(differentBreakWater);

            foreshoreProfile.CopyProperties(foreshoreProfileToUpdateFrom);
        }
コード例 #3
0
        /// <summary>
        /// Returns a collection of modified <see cref="ForeshoreProfile"/> entities, which all differ
        /// except for their id, name, orientation, and X0.
        /// </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(ForeshoreProfilePermutationHelper),
        ///     nameof(ForeshoreProfilePermutationHelper.DifferentForeshoreProfilesWithSameIdNameOrientationAndX0),
        ///     new object[]
        ///     {
        ///         "TargetMethodName",
        ///         "TestResult"
        ///     })]
        /// </code>
        /// </example>
        public static IEnumerable <TestCaseData> DifferentForeshoreProfilesWithSameIdNameOrientationAndX0(string targetName, string testResultDescription)
        {
            var referenceProfile = new TestForeshoreProfile();

            var defaultBreakWater = new BreakWater(BreakWaterType.Dam, 0.0);

            var testCaseData = new List <TestCaseData>
            {
                new TestCaseData(new TestForeshoreProfile(referenceProfile.Id, new[]
                {
                    new Point2D(0, 0),
                    new Point2D(1, 1)
                }))
                .SetName($"{targetName}_DifferentGeometry_{testResultDescription}"),
                new TestCaseData(new TestForeshoreProfile(new BreakWater(defaultBreakWater.Type, 1 + defaultBreakWater.Height)))
                .SetName($"{targetName}_DifferentBreakWaterHeight_{testResultDescription}"),
                new TestCaseData(new TestForeshoreProfile(new BreakWater(BreakWaterType.Caisson, defaultBreakWater.Height)))
                .SetName($"{targetName}_DifferentBreakWaterTypeCaisson_{testResultDescription}"),
                new TestCaseData(new TestForeshoreProfile(new BreakWater(BreakWaterType.Wall, defaultBreakWater.Height)))
                .SetName($"{targetName}_DifferentBreakWaterTypeWall_{testResultDescription}")
            };

            return(testCaseData);
        }