示例#1
0
        public void CreateUpperBoundaryWaterLevelsGeometryPoints_WithForeshoreProfile_ReturnsUpperBoundaryWaterLevelsGeometryPointsCollection(
            IEnumerable <Point2D> foreshoreProfileGeometry)
        {
            // Setup
            var input = new WaveConditionsInput
            {
                UpperBoundaryWaterLevels = (RoundedDouble)9,
                ForeshoreProfile         = new TestForeshoreProfile(foreshoreProfileGeometry)
            };

            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateUpperBoundaryWaterLevelsGeometryPoints(input);

            // Assert
            Point2D lastGeometryPoint = foreshoreProfileGeometry.Last();
            double  endPointX         = (input.UpperBoundaryWaterLevels - lastGeometryPoint.Y) / 3;

            var expectedPoints = new[]
            {
                new Point2D(foreshoreProfileGeometry.First().X, 9),
                new Point2D(endPointX + lastGeometryPoint.X, 9)
            };

            CollectionAssert.AreEqual(expectedPoints, points);
        }
示例#2
0
        public void CreateUpperBoundaryWaterLevelsGeometryPoints_UseForeshoreProfileFalse_ReturnsUpperBoundaryWaterLevelsGeometryPointsCollection()
        {
            // Setup
            var input = new WaveConditionsInput
            {
                UpperBoundaryWaterLevels = (RoundedDouble)9,
                ForeshoreProfile         = new TestForeshoreProfile(new[]
                {
                    new Point2D(0, 0),
                    new Point2D(3, 4)
                }),
                UseForeshore = false
            };

            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateUpperBoundaryWaterLevelsGeometryPoints(input);

            // Assert
            var expectedPoints = new[]
            {
                new Point2D(-10, 9),
                new Point2D(3, 9)
            };

            CollectionAssert.AreEqual(expectedPoints, points);
        }
示例#3
0
        public void CreateAssessmentLevelGeometryPoints_UseForeshoreProfileFalse_ReturnsAssessmentLevelGeometryPointsCollection()
        {
            // Setup
            var input = new WaveConditionsInput
            {
                ForeshoreProfile = new TestForeshoreProfile(new[]
                {
                    new Point2D(0, 0),
                    new Point2D(3, 4)
                }),
                UseForeshore = false
            };

            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateAssessmentLevelGeometryPoints(input, GetValidAssessmentLevel());

            // Assert
            var expectedPoints = new[]
            {
                new Point2D(-10, 6),
                new Point2D(2, 6)
            };

            CollectionAssert.AreEqual(expectedPoints, points);
        }
示例#4
0
        public void CreateRevetmentBaseGeometryPoints_InputWithForeshoreProfileAndLowerBoundaryWaterLevelsBelowForeshoreProfile_ReturnRevetmentBaseGeometryPointsCollection(
            IEnumerable <Point2D> foreshoreProfileGeometry)
        {
            // Setup
            const double lowerBoundaryRevetment   = 2;
            const double upperBoundaryRevetment   = 8;
            const double lowerBoundaryWaterLevels = -3;

            var input = new WaveConditionsInput
            {
                LowerBoundaryWaterLevels = (RoundedDouble)lowerBoundaryWaterLevels,
                LowerBoundaryRevetment   = (RoundedDouble)lowerBoundaryRevetment,
                UpperBoundaryRevetment   = (RoundedDouble)upperBoundaryRevetment,
                ForeshoreProfile         = new TestForeshoreProfile(foreshoreProfileGeometry)
            };

            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateRevetmentBaseGeometryPoints(input);

            // Assert
            Point2D lastGeometryPoint = foreshoreProfileGeometry.Last();

            var expectedGeometry = new[]
            {
                new Point2D((lowerBoundaryWaterLevels - lastGeometryPoint.Y) / 3 + lastGeometryPoint.X, lowerBoundaryWaterLevels),
                new Point2D(lastGeometryPoint),
                new Point2D((lowerBoundaryRevetment - lastGeometryPoint.Y) / 3 + lastGeometryPoint.X, lowerBoundaryRevetment)
            };

            CollectionAssert.AreEqual(expectedGeometry, points);
        }
示例#5
0
        public void CreateRevetmentBaseGeometryPoints_InputUseForeshoreProfileFalse_ReturnRevetmentBaseGeometryPointsCollection()
        {
            // Setup
            const double lowerBoundaryRevetment = 2;
            const double upperBoundaryRevetment = 8;

            var input = new WaveConditionsInput
            {
                LowerBoundaryRevetment = (RoundedDouble)lowerBoundaryRevetment,
                UpperBoundaryRevetment = (RoundedDouble)upperBoundaryRevetment,
                ForeshoreProfile       = new TestForeshoreProfile(new[]
                {
                    new Point2D(1, 1),
                    new Point2D(3, 5),
                    new Point2D(10, 7)
                }),
                UseForeshore = false
            };

            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateRevetmentBaseGeometryPoints(input);

            // Assert
            CollectionAssert.AreEqual(new[]
            {
                new Point2D(0, 0),
                new Point2D(lowerBoundaryRevetment / 3, 2)
            }, points);
        }
示例#6
0
        public void CreateWaterLevelsGeometryPoints_NoForeshoreProfile_ReturnsWaterLevelsGeometryPointsCollection()
        {
            // Setup
            var input = new WaveConditionsInput
            {
                LowerBoundaryRevetment = (RoundedDouble)5,
                UpperBoundaryRevetment = (RoundedDouble)7,
                StepSize = WaveConditionsInputStepSize.One
            };

            // Call
            IEnumerable <IEnumerable <Point2D> > lines = WaveConditionsChartDataPointsFactory.CreateWaterLevelsGeometryPoints(input, (RoundedDouble)6.01);

            // Assert
            var expectedLines = new[]
            {
                new[]
                {
                    new Point2D(-10, 6),
                    new Point2D(2, 6)
                },
                new[]
                {
                    new Point2D(-10, 5),
                    new Point2D(1.666667, 5)
                }
            };

            AssertWaterLevelGeometries(expectedLines, lines);
        }
示例#7
0
        public void CreateAssessmentLevelGeometryPoints_WithForeshoreProfile_ReturnsAssessmentLevelGeometryPointsCollection(
            IEnumerable <Point2D> foreshoreProfileGeometry)
        {
            // Setup
            RoundedDouble assessmentLevel = GetValidAssessmentLevel();
            var           input           = new WaveConditionsInput
            {
                ForeshoreProfile = new TestForeshoreProfile(foreshoreProfileGeometry)
            };

            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateAssessmentLevelGeometryPoints(input, assessmentLevel);

            // Assert
            Point2D lastGeometryPoint = foreshoreProfileGeometry.Last();
            double  endPointX         = (assessmentLevel - lastGeometryPoint.Y) / 3;

            var expectedPoints = new[]
            {
                new Point2D(foreshoreProfileGeometry.First().X, 6),
                new Point2D(endPointX + lastGeometryPoint.X, 6)
            };

            CollectionAssert.AreEqual(expectedPoints, points);
        }
示例#8
0
        public void CreateWaterLevelsGeometryPoints_InputNull_ReturnsEmptyLinesList()
        {
            // Call
            IEnumerable <IEnumerable <Point2D> > lines = WaveConditionsChartDataPointsFactory.CreateWaterLevelsGeometryPoints(null, RoundedDouble.NaN);

            // Assert
            CollectionAssert.IsEmpty(lines);
        }
示例#9
0
        public void CreateUpperBoundaryRevetmentGeometryPoints_InputNull_ReturnsEmptyPointsCollection()
        {
            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateUpperBoundaryRevetmentGeometryPoints(null);

            // Assert
            CollectionAssert.IsEmpty(points);
        }
示例#10
0
        public void CreateRevetmentBaseGeometryPoints_BoundariesNotSet_ReturnsEmptyPointsCollection(WaveConditionsInput input)
        {
            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateRevetmentGeometryPoints(input);

            // Assert
            CollectionAssert.IsEmpty(points);
        }
示例#11
0
        public void CreateUpperBoundaryWaterLevelsGeometryPoints_UpperBoundaryWaterLevelsNaN_ReturnsEmptyPointsCollection()
        {
            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateUpperBoundaryWaterLevelsGeometryPoints(new WaveConditionsInput());

            // Assert
            CollectionAssert.IsEmpty(points);
        }
示例#12
0
        public void CreateAssessmentLevelGeometryPoints_InputNull_ReturnsEmptyPointsCollection()
        {
            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateAssessmentLevelGeometryPoints(null, RoundedDouble.NaN);

            // Assert
            CollectionAssert.IsEmpty(points);
        }
示例#13
0
        public void CreateAssessmentLevelGeometryPoints_AssessmentLevelNaN_ReturnsEmptyPointsCollection()
        {
            // Setup
            var input = new WaveConditionsInput();

            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateAssessmentLevelGeometryPoints(input, RoundedDouble.NaN);

            // Assert
            CollectionAssert.IsEmpty(points);
        }
示例#14
0
        public void CreateForeshoreGeometryPoints_ForeshoreProfileNull_ReturnsEmptyPointsCollection()
        {
            // Setup
            var input = new WaveConditionsInput
            {
                UseForeshore = true
            };

            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateForeshoreGeometryPoints(input);

            // Assert
            CollectionAssert.IsEmpty(points);
        }
示例#15
0
        public void CreateForeshoreGeometryPoints_ForeshoreProfileSetUseForeshoreFalse_ReturnsEmptyPointsCollection()
        {
            // Setup
            var input = new WaveConditionsInput
            {
                ForeshoreProfile = new TestForeshoreProfile(new[]
                {
                    new Point2D(1.1, 2.2),
                    new Point2D(3.3, 4.4)
                }),
                UseForeshore = false
            };

            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateForeshoreGeometryPoints(input);

            // Assert
            CollectionAssert.IsEmpty(points);
        }
示例#16
0
        public void CreateForeshoreGeometryPoints_ForeshoreProfileSetUseForeshoreTrue_ReturnsForeshoreGeometryPointsCollection()
        {
            // Setup
            var foreshoreGeometry = new[]
            {
                new Point2D(1.1, 2.2),
                new Point2D(3.3, 4.4)
            };
            var input = new WaveConditionsInput
            {
                ForeshoreProfile = new TestForeshoreProfile(foreshoreGeometry),
                UseForeshore     = true
            };

            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateForeshoreGeometryPoints(input);

            // Assert
            CollectionAssert.AreEqual(foreshoreGeometry, points);
        }
示例#17
0
        public void CreateUpperBoundaryRevetmentGeometryPoints_NoForeshoreProfile_ReturnsUpperBoundaryRevetmentGeometryPointsCollection()
        {
            // Setup
            var input = new WaveConditionsInput
            {
                UpperBoundaryRevetment = (RoundedDouble)9
            };

            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateUpperBoundaryRevetmentGeometryPoints(input);

            // Assert
            var expectedPoints = new[]
            {
                new Point2D(-10, 9),
                new Point2D(3, 9)
            };

            CollectionAssert.AreEqual(expectedPoints, points);
        }
示例#18
0
        public void CreateLowerBoundaryWaterLevelsGeometryPoints_NoForeshoreProfile_ReturnsLowerBoundaryWaterLevelsGeometryPointsCollection()
        {
            // Setup
            var input = new WaveConditionsInput
            {
                LowerBoundaryWaterLevels = (RoundedDouble)3
            };

            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateLowerBoundaryWaterLevelsGeometryPoints(input);

            // Assert
            var expectedPoints = new[]
            {
                new Point2D(-10, 3),
                new Point2D(1, 3)
            };

            CollectionAssert.AreEqual(expectedPoints, points);
        }
示例#19
0
        private void SetChartData()
        {
            WaveConditionsInput input = calculation.InputParameters;

            WaveConditionsChartDataFactory.UpdateForeshoreGeometryChartDataName(foreshoreChartData, input);

            foreshoreChartData.Points = WaveConditionsChartDataPointsFactory.CreateForeshoreGeometryPoints(input);
            lowerBoundaryRevetmentChartData.Points   = WaveConditionsChartDataPointsFactory.CreateLowerBoundaryRevetmentGeometryPoints(input);
            upperBoundaryRevetmentChartData.Points   = WaveConditionsChartDataPointsFactory.CreateUpperBoundaryRevetmentGeometryPoints(input);
            lowerBoundaryWaterLevelsChartData.Points = WaveConditionsChartDataPointsFactory.CreateLowerBoundaryWaterLevelsGeometryPoints(input);
            upperBoundaryWaterLevelsChartData.Points = WaveConditionsChartDataPointsFactory.CreateUpperBoundaryWaterLevelsGeometryPoints(input);

            RoundedDouble assessmentLevel = getHydraulicBoundaryLocationCalculationFunc()?.Output?.Result ?? RoundedDouble.NaN;

            assessmentLevelChartData.Points = WaveConditionsChartDataPointsFactory.CreateAssessmentLevelGeometryPoints(input, assessmentLevel);
            waterLevelsChartData.Lines      = WaveConditionsChartDataPointsFactory.CreateWaterLevelsGeometryPoints(input, assessmentLevel);

            revetmentBaseChartData.Points = WaveConditionsChartDataPointsFactory.CreateRevetmentBaseGeometryPoints(input);
            revetmentChartData.Points     = WaveConditionsChartDataPointsFactory.CreateRevetmentGeometryPoints(input);
        }
示例#20
0
        public void CreateRevetmentGeometryPoints_InputWithoutForeshoreProfile_ReturnRevetmentGeometryPointsCollection()
        {
            // Setup
            const double lowerBoundaryRevetment = 2;
            const double upperBoundaryRevetment = 8;

            var input = new WaveConditionsInput
            {
                LowerBoundaryRevetment = (RoundedDouble)lowerBoundaryRevetment,
                UpperBoundaryRevetment = (RoundedDouble)upperBoundaryRevetment
            };

            // Call
            IEnumerable <Point2D> points = WaveConditionsChartDataPointsFactory.CreateRevetmentGeometryPoints(input);

            // Assert
            CollectionAssert.AreEqual(new[]
            {
                new Point2D(lowerBoundaryRevetment / 3, 2),
                new Point2D(upperBoundaryRevetment / 3, 8)
            }, points);
        }
示例#21
0
        public void CreateWaterLevelsGeometryPoints_WithForeshoreProfile_ReturnsWaterLevelsGeometryPointsCollection(
            IEnumerable <Point2D> foreshoreProfileGeometry)
        {
            // Setup
            RoundedDouble assessmentLevel = GetValidAssessmentLevel();
            var           input           = new WaveConditionsInput
            {
                ForeshoreProfile       = new TestForeshoreProfile(foreshoreProfileGeometry),
                LowerBoundaryRevetment = (RoundedDouble)5,
                UpperBoundaryRevetment = (RoundedDouble)7,
                StepSize = WaveConditionsInputStepSize.One
            };

            // Call
            IEnumerable <IEnumerable <Point2D> > lines = WaveConditionsChartDataPointsFactory.CreateWaterLevelsGeometryPoints(input, assessmentLevel);

            // Assert
            Point2D lastGeometryPoint = foreshoreProfileGeometry.Last();

            IEnumerable <RoundedDouble> waterLevels = input.GetWaterLevels(assessmentLevel);

            var expectedLines = new[]
            {
                new[]
                {
                    new Point2D(foreshoreProfileGeometry.First().X, 6),
                    new Point2D(((waterLevels.ElementAt(0) - lastGeometryPoint.Y) / 3) + lastGeometryPoint.X, 6)
                },
                new[]
                {
                    new Point2D(foreshoreProfileGeometry.First().X, 5),
                    new Point2D(((waterLevels.ElementAt(1) - lastGeometryPoint.Y) / 3) + lastGeometryPoint.X, 5)
                }
            };

            AssertWaterLevelGeometries(expectedLines, lines);
        }