示例#1
0
        public IEnumerable <SelectableHydraulicBoundaryLocation> GetSelectableHydraulicBoundaryLocations()
        {
            Point2D referenceLocation = data.WrappedData.Structure?.Location;

            return(SelectableHydraulicBoundaryLocationHelper.GetSortedSelectableHydraulicBoundaryLocations(
                       data.AssessmentSection.HydraulicBoundaryDatabase.Locations, referenceLocation));
        }
示例#2
0
        /// <summary>
        /// Gets the available selectable hydraulic boundary locations on <see cref="MacroStabilityInwardsInputContext"/>.
        /// </summary>
        public IEnumerable <SelectableHydraulicBoundaryLocation> GetSelectableHydraulicBoundaryLocations()
        {
            Point2D referencePoint = SurfaceLine?.ReferenceLineIntersectionWorldPoint;

            return(SelectableHydraulicBoundaryLocationHelper.GetSortedSelectableHydraulicBoundaryLocations(
                       data.AssessmentSection.HydraulicBoundaryDatabase.Locations, referencePoint));
        }
        public IEnumerable <SelectableHydraulicBoundaryLocation> GetSelectableHydraulicBoundaryLocations()
        {
            Point2D referenceLocation = data.WrappedData.ForeshoreProfile?.WorldReferencePoint;

            return(SelectableHydraulicBoundaryLocationHelper.GetSortedSelectableHydraulicBoundaryLocations(
                       data.HydraulicBoundaryLocations, referenceLocation));
        }
        public void GetSortedSelectableHydraulicBoundaryLocations_WithLocationsAndPoint_ReturnLocationsSortedByDistanceThenById()
        {
            // Setup
            var hydraulicBoundaryLocations = new[]
            {
                new HydraulicBoundaryLocation(1, "A", 0, 10),
                new HydraulicBoundaryLocation(4, "E", 0, 500),
                new HydraulicBoundaryLocation(6, "F", 0, 100),
                new HydraulicBoundaryLocation(5, "D", 0, 200),
                new HydraulicBoundaryLocation(3, "C", 0, 200),
                new HydraulicBoundaryLocation(2, "B", 0, 200)
            };

            var point2D = new Point2D(0.0, 0.0);

            // Call
            IEnumerable <SelectableHydraulicBoundaryLocation> selectableHydraulicBoundaryLocations =
                SelectableHydraulicBoundaryLocationHelper.GetSortedSelectableHydraulicBoundaryLocations(hydraulicBoundaryLocations, point2D);

            // Assert
            IEnumerable <SelectableHydraulicBoundaryLocation> expectedList =
                hydraulicBoundaryLocations.Select(hbl => new SelectableHydraulicBoundaryLocation(hbl, point2D))
                .OrderBy(hbl => hbl.Distance)
                .ThenBy(hbl => hbl.HydraulicBoundaryLocation.Id);

            CollectionAssert.AreEqual(expectedList, selectableHydraulicBoundaryLocations);
        }
        public void GetSortedSelectableHydraulicBoundaryLocations_LocationsNull_ThrowsArgumentNullException()
        {
            // Setup
            var point2D = new Point2D(0.0, 0.0);

            // Call
            TestDelegate call = () => SelectableHydraulicBoundaryLocationHelper.GetSortedSelectableHydraulicBoundaryLocations(null, point2D);

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

            Assert.AreEqual("hydraulicBoundaryLocations", paramName);
        }
        public void GetSortedSelectableHydraulicBoundaryLocations_WithLocationsReferencePointNull_ReturnLocationsSortedById()
        {
            // Setup
            var hydraulicBoundaryLocations = new[]
            {
                new HydraulicBoundaryLocation(1, "A", 0, 1),
                new HydraulicBoundaryLocation(4, "C", 0, 2),
                new HydraulicBoundaryLocation(3, "D", 0, 3),
                new HydraulicBoundaryLocation(2, "B", 0, 4)
            };

            // Call
            IEnumerable <SelectableHydraulicBoundaryLocation> selectableHydraulicBoundaryLocations =
                SelectableHydraulicBoundaryLocationHelper.GetSortedSelectableHydraulicBoundaryLocations(hydraulicBoundaryLocations, null);

            // Assert
            IEnumerable <SelectableHydraulicBoundaryLocation> expectedList =
                hydraulicBoundaryLocations.Select(hbl => new SelectableHydraulicBoundaryLocation(hbl, null))
                .OrderBy(hbl => hbl.HydraulicBoundaryLocation.Id);

            CollectionAssert.AreEqual(expectedList, selectableHydraulicBoundaryLocations);
        }