示例#1
0
        private AssessmentSectionExtendedView ShowCalculationsView(IAssessmentSection assessmentSection)
        {
            var assessmentSectionView = new AssessmentSectionExtendedView(assessmentSection);

            testForm.Controls.Add(assessmentSectionView);
            testForm.Show();

            return(assessmentSectionView);
        }
示例#2
0
        public void Constructor_ExpectedValues()
        {
            // Setup
            var assessmentSection = new AssessmentSectionStub();

            // Call
            AssessmentSectionExtendedView extendedView = ShowCalculationsView(assessmentSection);

            // Assert
            Assert.IsInstanceOf <AssessmentSectionReferenceLineView>(extendedView);
        }
示例#3
0
        public void UpdateObserver_DataUpdated_MapLayersSameOrder()
        {
            // Setup
            var referenceLine = new ReferenceLine();

            referenceLine.SetGeometry(new[]
            {
                new Point2D(1.0, 2.0),
                new Point2D(2.0, 1.0)
            });

            var assessmentSection = new AssessmentSectionStub
            {
                ReferenceLine = referenceLine
            };

            assessmentSection.SetHydraulicBoundaryLocationCalculations(new[]
            {
                new HydraulicBoundaryLocation(1, "test1", 1.0, 2.0)
            });

            AssessmentSectionExtendedView extendedView = ShowCalculationsView(assessmentSection);
            MapDataCollection             mapData      = extendedView.Map.Data;

            MapData dataToMove = mapData.Collection.ElementAt(0);

            mapData.Remove(dataToMove);
            mapData.Add(dataToMove);

            // Precondition
            var referenceLineMapData = (MapLineData)mapData.Collection.ElementAt(referenceLineIndex + 1);

            Assert.AreEqual("Referentielijn", referenceLineMapData.Name);

            var hrLocationsMapData = (MapPointData)mapData.Collection.ElementAt(hydraulicBoundaryLocationsIndex - 1);

            Assert.AreEqual("Hydraulische belastingen", hrLocationsMapData.Name);

            // Call
            assessmentSection.SetHydraulicBoundaryLocationCalculations(new[]
            {
                new HydraulicBoundaryLocation(2, "test2", 2.0, 3.0)
            });
            assessmentSection.HydraulicBoundaryDatabase.Locations.NotifyObservers();

            // Assert
            var actualReferenceLineMapData = (MapLineData)mapData.Collection.ElementAt(referenceLineIndex + 1);

            Assert.AreEqual("Referentielijn", actualReferenceLineMapData.Name);

            var actualHrLocationsMapData = (MapPointData)mapData.Collection.ElementAt(hydraulicBoundaryLocationsIndex - 1);

            Assert.AreEqual("Hydraulische belastingen", actualHrLocationsMapData.Name);
        }
示例#4
0
        public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue()
        {
            // Setup
            var random            = new Random(21);
            var assessmentSection = new AssessmentSection(random.NextEnumValue <AssessmentSectionComposition>());

            var view = new AssessmentSectionExtendedView(assessmentSection);

            // Call
            bool closeForData = info.CloseForData(view, assessmentSection);

            // Assert
            Assert.IsTrue(closeForData);
        }
示例#5
0
        public void Constructor_WithReferenceLineAndHydraulicBoundaryDatabase_DataUpdatedToCollectionOfFilledMapData()
        {
            // Setup
            var referenceLine = new ReferenceLine();

            referenceLine.SetGeometry(new[]
            {
                new Point2D(1.0, 2.0),
                new Point2D(2.0, 1.0)
            });

            var assessmentSection = new AssessmentSectionStub
            {
                ReferenceLine = referenceLine
            };

            assessmentSection.SetHydraulicBoundaryLocationCalculations(new[]
            {
                new HydraulicBoundaryLocation(1, "test", 1.0, 2.0)
            });

            // Call
            AssessmentSectionExtendedView extendedView = ShowCalculationsView(assessmentSection);

            // Assert
            Assert.IsInstanceOf <MapDataCollection>(extendedView.Map.Data);
            MapDataCollection mapData = extendedView.Map.Data;

            Assert.IsNotNull(mapData);

            MapData hydraulicBoundaryLocationsMapData = mapData.Collection.ElementAt(hydraulicBoundaryLocationsIndex);

            MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(assessmentSection, hydraulicBoundaryLocationsMapData);

            MapData referenceLineMapData = mapData.Collection.ElementAt(referenceLineIndex);

            MapDataTestHelper.AssertReferenceLineMapData(referenceLine, referenceLineMapData);
            Assert.IsTrue(referenceLineMapData.IsVisible);
        }