private AssessmentSectionExtendedView ShowCalculationsView(IAssessmentSection assessmentSection) { var assessmentSectionView = new AssessmentSectionExtendedView(assessmentSection); testForm.Controls.Add(assessmentSectionView); testForm.Show(); return(assessmentSectionView); }
public void Constructor_ExpectedValues() { // Setup var assessmentSection = new AssessmentSectionStub(); // Call AssessmentSectionExtendedView extendedView = ShowCalculationsView(assessmentSection); // Assert Assert.IsInstanceOf <AssessmentSectionReferenceLineView>(extendedView); }
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); }
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); }
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); }