Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public void UpdateObserver_DataUpdated_MapLayersSameOrder()
        {
            // Setup
            const int updatedReferenceLineLayerIndex = referenceLineIndex + 1;
            const int updatedDuneLocationsLayerIndex = duneLocationsIndex - 1;

            var assessmentSection = new AssessmentSectionStub();
            var failureMechanism  = new DuneErosionFailureMechanism();

            DuneErosionFailureMechanismView view = CreateView(failureMechanism, assessmentSection);

            IMapControl map = ((RiskeerMapControl)view.Controls[0]).MapControl;

            MapDataCollection mapData = map.Data;

            var dataToMove = (MapLineData)map.Data.Collection.ElementAt(referenceLineIndex);

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

            List <MapData> mapDataList = mapData.Collection.ToList();

            // Precondition
            var referenceLineData = (MapLineData)mapDataList[updatedReferenceLineLayerIndex];

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

            var duneLocationsData = (MapPointData)mapDataList[updatedDuneLocationsLayerIndex];

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

            var points = new List <Point2D>
            {
                new Point2D(2.0, 5.0),
                new Point2D(4.0, 3.0)
            };
            var referenceLine = new ReferenceLine();

            referenceLine.SetGeometry(points);
            assessmentSection.ReferenceLine = referenceLine;

            // Call
            assessmentSection.NotifyObservers();

            // Assert
            var actualReferenceLineData = (MapLineData)mapDataList[updatedReferenceLineLayerIndex];

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

            var actualDuneLocationsData = (MapPointData)mapDataList[updatedDuneLocationsLayerIndex];

            Assert.AreEqual("Hydraulische belastingen", actualDuneLocationsData.Name);
        }
Exemplo n.º 3
0
        public void Remove_ExistingItem_RemovesItem()
        {
            // Setup
            var item = new MapLineData("test");
            var mapDataCollection = new MapDataCollection("test");

            mapDataCollection.Add(item);

            // Precondition
            Assert.AreEqual(1, mapDataCollection.Collection.Count());
            Assert.IsInstanceOf <MapLineData>(mapDataCollection.Collection.First());

            // Call
            mapDataCollection.Remove(item);

            // Assert
            CollectionAssert.IsEmpty(mapDataCollection.Collection);
        }
Exemplo n.º 4
0
        public void Remove_Null_DoesNotRemove()
        {
            // Setup
            var item = new MapLineData("test");
            var mapDataCollection = new MapDataCollection("test");

            mapDataCollection.Add(item);

            // Precondition
            Assert.AreEqual(1, mapDataCollection.Collection.Count());
            Assert.IsInstanceOf <MapLineData>(mapDataCollection.Collection.First());
            List <MapData> listBeforeRemove = mapDataCollection.Collection.ToList();

            // Call
            mapDataCollection.Remove(null);

            // Assert
            CollectionAssert.AreEqual(listBeforeRemove, mapDataCollection.Collection);
        }
Exemplo n.º 5
0
        public void UpdateObserver_DataUpdated_MapLayersSameOrder()
        {
            // Setup
            const int updatedReferenceLineLayerIndex            = referenceLineIndex + 7;
            const int updatedSurfaceLineLayerIndex              = surfaceLinesIndex - 1;
            const int updatedSectionCollectionIndex             = sectionsCollectionIndex - 1;
            const int updatedAssemblyResultsIndex               = assemblyResultsIndex - 1;
            const int updatedHydraulicLocationsLayerIndex       = hydraulicBoundaryLocationsIndex - 1;
            const int updatedStochasticSoilModelsLayerIndex     = stochasticSoilModelsIndex - 1;
            const int updatedProbabilisticCalculationsIndex     = probabilisticCalculationsIndex - 1;
            const int updatedSemiProbabilisticCalculationsIndex = semiProbabilisticCalculationsIndex - 1;

            var assessmentSection = new AssessmentSectionStub();

            PipingFailureMechanismView view = CreateView(new PipingFailureMechanism(), assessmentSection);

            IMapControl map = ((RiskeerMapControl)view.Controls[0]).MapControl;

            MapDataCollection mapData = map.Data;

            var dataToMove = (MapLineData)map.Data.Collection.ElementAt(referenceLineIndex);

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

            IEnumerable <MapData> mapDataCollection = mapData.Collection;

            // Precondition
            var referenceLineData = (MapLineData)mapDataCollection.ElementAt(updatedReferenceLineLayerIndex);

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

            var surfaceLineData = (MapLineData)mapDataCollection.ElementAt(updatedSurfaceLineLayerIndex);

            Assert.AreEqual("Profielschematisaties", surfaceLineData.Name);

            var sectionsData = (MapDataCollection)mapDataCollection.ElementAt(updatedSectionCollectionIndex);

            Assert.AreEqual("Vakindeling", sectionsData.Name);

            var assemblyResultsData = (MapLineData)mapDataCollection.ElementAt(updatedAssemblyResultsIndex);

            Assert.AreEqual("Duidingsklasse per vak", assemblyResultsData.Name);

            var hydraulicLocationsData = (MapPointData)mapDataCollection.ElementAt(updatedHydraulicLocationsLayerIndex);

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

            var stochasticSoilModelsData = (MapLineData)mapDataCollection.ElementAt(updatedStochasticSoilModelsLayerIndex);

            Assert.AreEqual("Stochastische ondergrondmodellen", stochasticSoilModelsData.Name);

            var probabilisticCalculationsData = (MapLineData)mapDataCollection.ElementAt(updatedProbabilisticCalculationsIndex);

            Assert.AreEqual("Probabilistische berekeningen", probabilisticCalculationsData.Name);

            var semiProbabilisticCalculationsData = (MapLineData)mapDataCollection.ElementAt(updatedSemiProbabilisticCalculationsIndex);

            Assert.AreEqual("Semi-probabilistische berekeningen", semiProbabilisticCalculationsData.Name);

            var points = new List <Point2D>
            {
                new Point2D(2.0, 5.0),
                new Point2D(4.0, 3.0)
            };
            var referenceLine = new ReferenceLine();

            referenceLine.SetGeometry(points);
            assessmentSection.ReferenceLine = referenceLine;

            // Call
            assessmentSection.NotifyObservers();

            // Assert
            var actualReferenceLineData = (MapLineData)mapDataCollection.ElementAt(updatedReferenceLineLayerIndex);

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

            var actualSurfaceLineData = (MapLineData)mapDataCollection.ElementAt(updatedSurfaceLineLayerIndex);

            Assert.AreEqual("Profielschematisaties", actualSurfaceLineData.Name);

            var actualSectionsData = (MapDataCollection)mapDataCollection.ElementAt(updatedSectionCollectionIndex);

            Assert.AreEqual("Vakindeling", actualSectionsData.Name);

            var actualAssemblyResultsData = (MapLineData)mapDataCollection.ElementAt(updatedAssemblyResultsIndex);

            Assert.AreEqual("Duidingsklasse per vak", actualAssemblyResultsData.Name);

            var actualHydraulicLocationsData = (MapPointData)mapDataCollection.ElementAt(updatedHydraulicLocationsLayerIndex);

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

            var actualStochasticSoilModelsData = (MapLineData)mapDataCollection.ElementAt(updatedStochasticSoilModelsLayerIndex);

            Assert.AreEqual("Stochastische ondergrondmodellen", actualStochasticSoilModelsData.Name);

            var actualSemiProbabilisticCalculationsData = (MapLineData)mapDataCollection.ElementAt(updatedSemiProbabilisticCalculationsIndex);

            Assert.AreEqual("Semi-probabilistische berekeningen", actualSemiProbabilisticCalculationsData.Name);

            var actualProbabilisticCalculationsData = (MapLineData)mapDataCollection.ElementAt(updatedProbabilisticCalculationsIndex);

            Assert.AreEqual("Probabilistische berekeningen", actualProbabilisticCalculationsData.Name);
        }
Exemplo n.º 6
0
        public void UpdateObserver_DataUpdated_MapLayersSameOrder()
        {
            // Setup
            const int updatedReferenceLineLayerIndex      = referenceLineIndex + 3;
            const int updatedHydraulicLocationsLayerIndex = hydraulicBoundaryLocationsIndex - 1;
            const int updatedForeshoreProfilesLayerIndex  = foreshoreProfilesIndex - 1;
            const int updatedCalculationsIndex            = calculationsIndex - 1;

            var assessmentSection = new AssessmentSectionStub();
            var failureMechanism  = new StabilityStoneCoverFailureMechanism();

            StabilityStoneCoverFailureMechanismView view = CreateView(failureMechanism, assessmentSection);

            IMapControl map = ((RiskeerMapControl)view.Controls[0]).MapControl;

            MapDataCollection mapData = map.Data;

            var dataToMove = (MapLineData)map.Data.Collection.ElementAt(referenceLineIndex);

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

            IEnumerable <MapData> mapDataCollection = mapData.Collection;

            // Precondition
            var referenceLineData = (MapLineData)mapDataCollection.ElementAt(updatedReferenceLineLayerIndex);

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

            var hydraulicLocationsData = (MapPointData)mapDataCollection.ElementAt(updatedHydraulicLocationsLayerIndex);

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

            var foreshoreProfilesData = (MapLineData)mapDataCollection.ElementAt(updatedForeshoreProfilesLayerIndex);

            Assert.AreEqual("Voorlandprofielen", foreshoreProfilesData.Name);

            var calculationsData = (MapLineData)mapDataCollection.ElementAt(updatedCalculationsIndex);

            Assert.AreEqual("Berekeningen", calculationsData.Name);

            var points = new List <Point2D>
            {
                new Point2D(2.0, 5.0),
                new Point2D(4.0, 3.0)
            };
            var referenceLine = new ReferenceLine();

            referenceLine.SetGeometry(points);
            assessmentSection.ReferenceLine = referenceLine;

            // Call
            assessmentSection.NotifyObservers();

            // Assert
            var actualReferenceLineData = (MapLineData)mapDataCollection.ElementAt(updatedReferenceLineLayerIndex);

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

            var actualHydraulicLocationsData = (MapPointData)mapDataCollection.ElementAt(updatedHydraulicLocationsLayerIndex);

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

            var actualForeshoreProfilesData = (MapLineData)mapDataCollection.ElementAt(updatedForeshoreProfilesLayerIndex);

            Assert.AreEqual("Voorlandprofielen", actualForeshoreProfilesData.Name);

            var actualCalculationsData = (MapLineData)mapDataCollection.ElementAt(updatedCalculationsIndex);

            Assert.AreEqual("Berekeningen", actualCalculationsData.Name);
        }
        public void NotifyObservers_DataUpdated_MapLayersSameOrder()
        {
            // Setup
            const int updatedReferenceLineLayerIndex      = referenceLineIndex + 6;
            const int updatedSectionCollectionIndex       = sectionsCollectionIndex - 1;
            const int updatedAssemblyResultsIndex         = assemblyResultsIndex - 1;
            const int updatedHydraulicLocationsLayerIndex = hydraulicBoundaryLocationsIndex - 1;
            const int updatedForeshoreProfilesLayerIndex  = foreshoreProfilesIndex - 1;
            const int updatedStructuresLayerIndex         = structuresIndex - 1;
            const int updatedCalculationsIndex            = calculationsIndex - 1;

            var assessmentSection = new AssessmentSectionStub();

            StabilityPointStructuresFailureMechanismView view = CreateView(new StabilityPointStructuresFailureMechanism(), assessmentSection);
            IMapControl map = ((RiskeerMapControl)view.Controls[0]).MapControl;

            MapDataCollection mapData = map.Data;

            var dataToMove = (MapLineData)map.Data.Collection.ElementAt(referenceLineIndex);

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

            List <MapData> mapDataList = mapData.Collection.ToList();

            // Precondition
            var referenceLineData = (MapLineData)mapDataList[updatedReferenceLineLayerIndex];

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

            var sectionsData = (MapDataCollection)mapDataList[updatedSectionCollectionIndex];

            Assert.AreEqual("Vakindeling", sectionsData.Name);

            var assemblyResultsData = (MapLineData)mapDataList[updatedAssemblyResultsIndex];

            Assert.AreEqual("Duidingsklasse per vak", assemblyResultsData.Name);

            var hydraulicLocationsData = (MapPointData)mapDataList[updatedHydraulicLocationsLayerIndex];

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

            var foreshoreProfilesData = (MapLineData)mapDataList[updatedForeshoreProfilesLayerIndex];

            Assert.AreEqual("Voorlandprofielen", foreshoreProfilesData.Name);

            var structuresData = (MapPointData)mapDataList[updatedStructuresLayerIndex];

            Assert.AreEqual("Kunstwerken", structuresData.Name);

            var calculationsData = (MapLineData)mapDataList[updatedCalculationsIndex];

            Assert.AreEqual("Berekeningen", calculationsData.Name);

            var points = new List <Point2D>
            {
                new Point2D(2.0, 5.0),
                new Point2D(4.0, 3.0)
            };
            var referenceLine = new ReferenceLine();

            referenceLine.SetGeometry(points);
            assessmentSection.ReferenceLine = referenceLine;

            // Call
            assessmentSection.NotifyObservers();

            // Assert
            var actualReferenceLineData = (MapLineData)mapDataList[updatedReferenceLineLayerIndex];

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

            var actualSectionsData = (MapDataCollection)mapDataList[updatedSectionCollectionIndex];

            Assert.AreEqual("Vakindeling", actualSectionsData.Name);

            var actualAssemblyResultsData = (MapLineData)mapDataList[updatedAssemblyResultsIndex];

            Assert.AreEqual("Duidingsklasse per vak", actualAssemblyResultsData.Name);

            var actualHydraulicLocationsData = (MapPointData)mapDataList[updatedHydraulicLocationsLayerIndex];

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

            var actualForeshoreProfilesData = (MapLineData)mapDataList[updatedForeshoreProfilesLayerIndex];

            Assert.AreEqual("Voorlandprofielen", actualForeshoreProfilesData.Name);

            var actualStructuresData = (MapPointData)mapDataList[updatedStructuresLayerIndex];

            Assert.AreEqual("Kunstwerken", actualStructuresData.Name);

            var actualCalculationsData = (MapLineData)mapDataList[updatedCalculationsIndex];

            Assert.AreEqual("Berekeningen", actualCalculationsData.Name);
        }
        public void UpdateObserver_DataUpdated_MapLayersSameOrder()
        {
            // Given
            const int updatedReferenceLineLayerIndex              = referenceLineIndex + hydraulicBoundaryLocationsIndex;
            const int updatedSectionsCollectionLayerIndex         = sectionsCollectionIndex - 1;
            const int updatedHydraulicBoundaryLocationsLayerIndex = hydraulicBoundaryLocationsIndex - 1;
            const int updatedAssemblyResultsIndex = assemblyResultsIndex - 1;

            var assessmentSection = new AssessmentSectionStub();
            var failureMechanism  = new SpecificFailureMechanism();

            SpecificFailureMechanismView view = CreateView(failureMechanism, assessmentSection);

            MapDataCollection     mapData           = view.Map.Data;
            IEnumerable <MapData> mapDataCollection = mapData.Collection;

            MapData dataToMove = mapDataCollection.ElementAt(referenceLineIndex);

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

            // Precondition
            MapData referenceLineData = mapDataCollection.ElementAt(updatedReferenceLineLayerIndex);

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

            MapData sectionsData = mapDataCollection.ElementAt(updatedSectionsCollectionLayerIndex);

            Assert.AreEqual("Vakindeling", sectionsData.Name);

            var assemblyResultsData = (MapLineData)mapDataCollection.ElementAt(updatedAssemblyResultsIndex);

            Assert.AreEqual("Duidingsklasse per vak", assemblyResultsData.Name);

            MapData hydraulicBoundaryLocationsData = mapDataCollection.ElementAt(updatedHydraulicBoundaryLocationsLayerIndex);

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

            // When
            var points = new List <Point2D>
            {
                new Point2D(2.0, 5.0),
                new Point2D(4.0, 3.0)
            };
            var referenceLine = new ReferenceLine();

            referenceLine.SetGeometry(points);
            assessmentSection.ReferenceLine = referenceLine;
            assessmentSection.NotifyObservers();

            // Then
            MapData actualReferenceLineData = mapDataCollection.ElementAt(updatedReferenceLineLayerIndex);

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

            MapData actualSectionsData = mapDataCollection.ElementAt(updatedSectionsCollectionLayerIndex);

            Assert.AreEqual("Vakindeling", actualSectionsData.Name);

            var actualAssemblyResultsData = (MapLineData)mapDataCollection.ElementAt(updatedAssemblyResultsIndex);

            Assert.AreEqual("Duidingsklasse per vak", actualAssemblyResultsData.Name);

            MapData actualHydraulicBoundaryLocationsData = mapDataCollection.ElementAt(updatedHydraulicBoundaryLocationsLayerIndex);

            Assert.AreEqual("Hydraulische belastingen", actualHydraulicBoundaryLocationsData.Name);
        }
Exemplo n.º 9
0
        public void UpdateObserver_DataUpdated_MapLayersSameOrder()
        {
            // Setup
            const int updatedReferenceLineLayerIndex      = referenceLineIndex + 3;
            const int updatedSectionCollectionIndex       = sectionsCollectionIndex - 1;
            const int updatedAssemblyResultsIndex         = assemblyResultsIndex - 1;
            const int updatedHydraulicLocationsLayerIndex = hydraulicBoundaryLocationsIndex - 1;

            var assessmentSection = new AssessmentSectionStub();
            var failureMechanism  = new TestFailureMechanism();

            using (StandAloneFailureMechanismView <IFailureMechanism <FailureMechanismSectionResult>, FailureMechanismSectionResult> view =
                       CreateView(failureMechanism, assessmentSection))
            {
                IMapControl map = ((RiskeerMapControl)view.Controls[0]).MapControl;

                MapDataCollection mapData = map.Data;

                var dataToMove = (MapLineData)map.Data.Collection.ElementAt(referenceLineIndex);
                mapData.Remove(dataToMove);
                mapData.Add(dataToMove);

                IEnumerable <MapData> mapDataCollection = mapData.Collection;

                // Precondition
                var referenceLineData = (MapLineData)mapDataCollection.ElementAt(updatedReferenceLineLayerIndex);
                Assert.AreEqual("Referentielijn", referenceLineData.Name);

                var sectionsData = (MapDataCollection)mapDataCollection.ElementAt(updatedSectionCollectionIndex);
                Assert.AreEqual("Vakindeling", sectionsData.Name);

                var assemblyResultsData = (MapLineData)mapDataCollection.ElementAt(updatedAssemblyResultsIndex);
                Assert.AreEqual("Duidingsklasse per vak", assemblyResultsData.Name);

                var hydraulicLocationsData = (MapPointData)mapDataCollection.ElementAt(updatedHydraulicLocationsLayerIndex);
                Assert.AreEqual("Hydraulische belastingen", hydraulicLocationsData.Name);

                var points = new List <Point2D>
                {
                    new Point2D(2.0, 5.0),
                    new Point2D(4.0, 3.0)
                };
                var referenceLine = new ReferenceLine();
                referenceLine.SetGeometry(points);
                assessmentSection.ReferenceLine = referenceLine;

                // Call
                assessmentSection.NotifyObservers();

                // Assert
                var actualReferenceLineData = (MapLineData)mapDataCollection.ElementAt(updatedReferenceLineLayerIndex);
                Assert.AreEqual("Referentielijn", actualReferenceLineData.Name);

                var actualSectionsData = (MapDataCollection)mapDataCollection.ElementAt(updatedSectionCollectionIndex);
                Assert.AreEqual("Vakindeling", actualSectionsData.Name);

                var actualAssemblyResultsData = (MapLineData)mapDataCollection.ElementAt(updatedAssemblyResultsIndex);
                Assert.AreEqual("Duidingsklasse per vak", actualAssemblyResultsData.Name);

                var actualHydraulicLocationsData = (MapPointData)mapDataCollection.ElementAt(updatedHydraulicLocationsLayerIndex);
                Assert.AreEqual("Hydraulische belastingen", actualHydraulicLocationsData.Name);
            }
        }