Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -raa8007e0a07c5ab485633583aa095ea34baf1a49 -r90de5f60de0a152b946e686873ffb15cae3a7038 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision aa8007e0a07c5ab485633583aa095ea34baf1a49) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 90de5f60de0a152b946e686873ffb15cae3a7038) @@ -93,6 +93,7 @@ + UserControl Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/DesignWaterLevelLocationRowTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/DesignWaterLevelLocationRowTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/DesignWaterLevelLocationRowTest.cs (revision 90de5f60de0a152b946e686873ffb15cae3a7038) @@ -0,0 +1,92 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base.Data; +using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; +using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; +using Ringtoets.Common.Forms.Views; +using Ringtoets.HydraRing.Data; + +namespace Ringtoets.Common.Forms.Test.Views +{ + [TestFixture] + public class DesignWaterLevelLocationRowTest + { + [Test] + public void Constructor_WithoutDesignWaterLevelLocationContext_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new DesignWaterLevelLocationRow(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("hydraulicBoundaryLocation", paramName); + } + + [Test] + public void Constructor_WithDesignWaterLevelLocationContext_PropertiesFromHydraulicBoundaryLocation() + { + // Setup + const int id = 1; + const string locationname = "LocationName"; + const double coordinateX = 1.0; + const double coordinateY = 2.0; + RoundedDouble designWaterLevel = (RoundedDouble) 3.0; + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, locationname, coordinateX, coordinateY) + { + DesignWaterLevel = designWaterLevel + }; + + // Call + var row = new DesignWaterLevelLocationRow(hydraulicBoundaryLocation); + + // Assert + Assert.IsInstanceOf(row); + Assert.AreEqual(id, row.Id); + Assert.AreEqual(locationname, row.Name); + Assert.AreEqual(designWaterLevel, row.DesignWaterLevel, hydraulicBoundaryLocation.DesignWaterLevel.GetAccuracy()); + var expectedPoint2D = new Point2D(coordinateX, coordinateY); + Assert.AreEqual(expectedPoint2D, row.Location); + Assert.AreSame(hydraulicBoundaryLocation, row.HydraulicBoundaryLocation); + Assert.IsFalse(row.ToCalculate); + Assert.IsTrue(TypeUtils.HasTypeConverter(r => r.DesignWaterLevel)); + } + + [Test] + public void Constructor_Property_SetPropertyAsExpected() + { + // Setup + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "LocationName", 1.0, 2.0); + var row = new DesignWaterLevelLocationRow(hydraulicBoundaryLocation); + + // Call + row.ToCalculate = true; + + // Assert + Assert.IsTrue(row.ToCalculate); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs =================================================================== diff -u -raa8007e0a07c5ab485633583aa095ea34baf1a49 -r90de5f60de0a152b946e686873ffb15cae3a7038 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision aa8007e0a07c5ab485633583aa095ea34baf1a49) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 90de5f60de0a152b946e686873ffb15cae3a7038) @@ -117,7 +117,8 @@ view.AssessmentSection = context.AssessmentSection; view.ApplicationSelection = Gui; view.CalculationGuiService = hydraulicBoundaryLocationCalculationGuiService; - } + }, + CloseForData = CloseDesignWaterLevelLocationsViewForData }; yield return new ViewInfo< @@ -137,6 +138,18 @@ }; } + private bool CloseDesignWaterLevelLocationsViewForData(GrassCoverErosionOutwardsDesignWaterLevelLocationsView view, object dataToCloseFor) + { + var section = dataToCloseFor as IAssessmentSection; + var failureMechanismContext = dataToCloseFor as GrassCoverErosionOutwardsFailureMechanismContext; + + var viewAssessmentSection = view.AssessmentSection; + var closeForFailureMechanism = failureMechanismContext != null && ReferenceEquals(failureMechanismContext.Parent, viewAssessmentSection); + var closeForSection = section != null && ReferenceEquals(section, viewAssessmentSection); + + return closeForSection || closeForFailureMechanism; + } + public override IEnumerable GetTreeNodeInfos() { yield return RingtoetsTreeNodeInfoFactory.CreateFailureMechanismContextTreeNodeInfo( Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewInfoTest.cs =================================================================== diff -u -r44ad6cd3235561c4491039dc0838226230708b9e -r90de5f60de0a152b946e686873ffb15cae3a7038 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewInfoTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsViewInfoTest.cs) (revision 44ad6cd3235561c4491039dc0838226230708b9e) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewInfoTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsViewInfoTest.cs) (revision 90de5f60de0a152b946e686873ffb15cae3a7038) @@ -41,7 +41,6 @@ [TestFixture] public class GrassCoverErosionOutwardsDesignWaterLevelLocationsViewInfoTest { - [TestCase] public void Initialized_Always_DataTypeAndViewTypeAsExpected() { @@ -88,6 +87,93 @@ mockRepository.VerifyAll(); } + [Test] + public void CloseViewForData_ForMatchingAssessmentSection_ReturnsTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView()) + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + var info = GetInfo(plugin); + view.AssessmentSection = assessmentSection; + + // Call + var closeForData = info.CloseForData(view, assessmentSection); + + // Assert + Assert.IsTrue(closeForData); + } + mocks.VerifyAll(); + } + + [Test] + public void CloseViewForData_ForNonMatchingAssessmentSection_ReturnsFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionA = mocks.Stub(); + var assessmentSectionB = mocks.Stub(); + mocks.ReplayAll(); + + using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView()) + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + var info = GetInfo(plugin); + view.AssessmentSection = assessmentSectionA; + + // Call + var closeForData = info.CloseForData(view, assessmentSectionB); + + // Assert + Assert.IsFalse(closeForData); + } + mocks.VerifyAll(); + } + + [Test] + public void CloseViewForData_ForOtherObjectType_ReturnsFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionA = mocks.Stub(); + mocks.ReplayAll(); + + using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView()) + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + var info = GetInfo(plugin); + view.Data = assessmentSectionA; + + // Call + var closeForData = info.CloseForData(view, new object()); + + // Assert + Assert.IsFalse(closeForData); + } + mocks.VerifyAll(); + } + + [Test] + public void CloseViewForData_ViewDataNull_ReturnsFalse() + { + // Setup + using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView()) + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + var info = GetInfo(plugin); + + // Call + var closeForData = info.CloseForData(view, new object()); + + // Assert + Assert.IsFalse(closeForData); + } + } + private ViewInfo GetInfo(PluginBase plugin) { return plugin.GetViewInfos().FirstOrDefault(vi => vi.ViewType == typeof(GrassCoverErosionOutwardsDesignWaterLevelLocationsView)); Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/HydraulicBoundaryDatabaseImporter.cs =================================================================== diff -u -r3d53c0f0b1a88c65b24a20f0add0ead3d796f0ca -r90de5f60de0a152b946e686873ffb15cae3a7038 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/HydraulicBoundaryDatabaseImporter.cs (.../HydraulicBoundaryDatabaseImporter.cs) (revision 3d53c0f0b1a88c65b24a20f0add0ead3d796f0ca) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/HydraulicBoundaryDatabaseImporter.cs (.../HydraulicBoundaryDatabaseImporter.cs) (revision 90de5f60de0a152b946e686873ffb15cae3a7038) @@ -63,7 +63,12 @@ var hydraulicBoundaryDatabase = targetItem.HydraulicBoundaryDatabase; if (!IsImportRequired(hydraulicBoundaryDatabase)) { + var isNotificationRequired = hydraulicBoundaryDatabase.FilePath != filePath; hydraulicBoundaryDatabase.FilePath = filePath; + if (isNotificationRequired) + { + targetItem.NotifyObservers(); + } } else { Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r88b44f34ed4dd17abbc44d54932215754cfd0601 -r90de5f60de0a152b946e686873ffb15cae3a7038 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 88b44f34ed4dd17abbc44d54932215754cfd0601) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 90de5f60de0a152b946e686873ffb15cae3a7038) @@ -313,6 +313,7 @@ return context.WrappedData.HydraulicBoundaryDatabase.Locations; }, Image = RingtoetsCommonFormsResources.GenericInputOutputIcon, + CloseForData = CloseDesignWaterLevelLocationsViewForData, AfterCreate = (view, context) => { view.AssessmentSection = context.WrappedData; @@ -333,6 +334,7 @@ return context.WrappedData.HydraulicBoundaryDatabase.Locations; }, Image = RingtoetsCommonFormsResources.GenericInputOutputIcon, + CloseForData = CloseWaveHeightLocationsViewForData, AfterCreate = (view, context) => { view.AssessmentSection = context.WrappedData; @@ -777,6 +779,30 @@ #endregion + #region DesignWaterLevelLocationsView ViewInfo + + private bool CloseDesignWaterLevelLocationsViewForData(DesignWaterLevelLocationsView view, object dataToCloseFor) + { + var viewData = view.AssessmentSection; + var assessmentSection = dataToCloseFor as IAssessmentSection; + + return assessmentSection != null && ReferenceEquals(viewData, assessmentSection); + } + + #endregion + + #region WaveHeightLocationsView ViewInfo + + private bool CloseWaveHeightLocationsViewForData(WaveHeightLocationsView view, object dataToCloseFor) + { + var viewData = view.AssessmentSection; + var assessmentSection = dataToCloseFor as IAssessmentSection; + + return assessmentSection != null && ReferenceEquals(viewData, assessmentSection); + } + + #endregion + #region FailureMechanismSectionsContext private ContextMenuStrip FailureMechanismSectionsContextMenuStrip(FailureMechanismSectionsContext nodeData, object parentData, TreeViewControl treeViewControl) Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -raa8007e0a07c5ab485633583aa095ea34baf1a49 -r90de5f60de0a152b946e686873ffb15cae3a7038 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision aa8007e0a07c5ab485633583aa095ea34baf1a49) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 90de5f60de0a152b946e686873ffb15cae3a7038) @@ -124,7 +124,6 @@ - Fisheye: Tag 90de5f60de0a152b946e686873ffb15cae3a7038 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationRowTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/HydraulicBoundaryDatabaseImporterTest.cs =================================================================== diff -u -r9a196c8bc554a2e97ff094d7ffb2e99c42eb04fd -r90de5f60de0a152b946e686873ffb15cae3a7038 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/HydraulicBoundaryDatabaseImporterTest.cs (.../HydraulicBoundaryDatabaseImporterTest.cs) (revision 9a196c8bc554a2e97ff094d7ffb2e99c42eb04fd) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/HydraulicBoundaryDatabaseImporterTest.cs (.../HydraulicBoundaryDatabaseImporterTest.cs) (revision 90de5f60de0a152b946e686873ffb15cae3a7038) @@ -210,6 +210,70 @@ } [Test] + public void Import_ImportingToSameDatabaseOnDifferentPath_FilePathUpdatedAndAssessmentSectionNotified() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + assessmentSection.Expect(section => section.NotifyObservers()).Repeat.Twice(); + mocks.ReplayAll(); + + string validFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin, + "completeWithLocationsToBeFilteredOut.sqlite"); + string copyValidFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin, + "copyOfCompleteWithLocationsToBeFilteredOut.sqlite"); + + + // Precondition + Assert.IsTrue(File.Exists(validFilePath), string.Format("Precodition failed. File does not exist: {0}", validFilePath)); + + importer.Import(assessmentSection, validFilePath); + + // Call + var importResult = importer.Import(assessmentSection, copyValidFilePath); + + // Assert + Assert.IsTrue(importResult); + Assert.AreEqual(copyValidFilePath, assessmentSection.HydraulicBoundaryDatabase.FilePath); + ICollection importedLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; + Assert.AreEqual(9, importedLocations.Count); + CollectionAssert.AllItemsAreNotNull(importedLocations); + CollectionAssert.AllItemsAreUnique(importedLocations); + mocks.VerifyAll(); + } + + [Test] + public void Import_ImportingToSameDatabaseOnSamePath_AssessmentSectionNotNotified() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + assessmentSection.Expect(section => section.NotifyObservers()); + mocks.ReplayAll(); + + string validFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin, + "completeWithLocationsToBeFilteredOut.sqlite"); + + + // Precondition + Assert.IsTrue(File.Exists(validFilePath), string.Format("Precodition failed. File does not exist: {0}", validFilePath)); + + importer.Import(assessmentSection, validFilePath); + + // Call + var importResult = importer.Import(assessmentSection, validFilePath); + + // Assert + Assert.IsTrue(importResult); + Assert.AreEqual(validFilePath, assessmentSection.HydraulicBoundaryDatabase.FilePath); + ICollection importedLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; + Assert.AreEqual(9, importedLocations.Count); + CollectionAssert.AllItemsAreNotNull(importedLocations); + CollectionAssert.AllItemsAreUnique(importedLocations); + mocks.VerifyAll(); + } + + [Test] public void Import_ImportingFileWithCorruptSchema_AbortAndLog() { // Setup Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/DesignWaterLevelLocationsViewInfoTest.cs =================================================================== diff -u -r88b44f34ed4dd17abbc44d54932215754cfd0601 -r90de5f60de0a152b946e686873ffb15cae3a7038 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/DesignWaterLevelLocationsViewInfoTest.cs (.../DesignWaterLevelLocationsViewInfoTest.cs) (revision 88b44f34ed4dd17abbc44d54932215754cfd0601) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/DesignWaterLevelLocationsViewInfoTest.cs (.../DesignWaterLevelLocationsViewInfoTest.cs) (revision 90de5f60de0a152b946e686873ffb15cae3a7038) @@ -126,9 +126,7 @@ { // Setup var mocks = new MockRepository(); - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); var assessmentSection = mocks.Stub(); - assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; IGui guiStub = mocks.Stub(); guiStub.Stub(g => g.ProjectOpened += null).IgnoreArguments(); @@ -139,6 +137,8 @@ mocks.ReplayAll(); var context = new DesignWaterLevelLocationsContext(assessmentSection); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; using (var view = new DesignWaterLevelLocationsView()) using (var ringtoetsPlugin = new RingtoetsPlugin()) @@ -157,5 +157,83 @@ mocks.VerifyAll(); } + + [Test] + public void CloseViewForData_ForMatchingAssessmentSection_ReturnsTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + using (var view = new DesignWaterLevelLocationsView()) + { + view.AssessmentSection = assessmentSection; + + // Call + var closeForData = info.CloseForData(view, assessmentSection); + + // Assert + Assert.IsTrue(closeForData); + } + mocks.VerifyAll(); + } + + [Test] + public void CloseViewForData_ForNonMatchingAssessmentSection_ReturnsFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionA = mocks.Stub(); + var assessmentSectionB = mocks.Stub(); + mocks.ReplayAll(); + + using (var view = new DesignWaterLevelLocationsView()) + { + view.AssessmentSection = assessmentSectionA; + + // Call + var closeForData = info.CloseForData(view, assessmentSectionB); + + // Assert + Assert.IsFalse(closeForData); + } + mocks.VerifyAll(); + } + + [Test] + public void CloseViewForData_ForOtherObjectType_ReturnsFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionA = mocks.Stub(); + mocks.ReplayAll(); + + using (var view = new DesignWaterLevelLocationsView()) + { + view.Data = assessmentSectionA; + + // Call + var closeForData = info.CloseForData(view, new object()); + + // Assert + Assert.IsFalse(closeForData); + } + mocks.VerifyAll(); + } + + [Test] + public void CloseViewForData_ViewDataNull_ReturnsFalse() + { + // Setup + using (var view = new DesignWaterLevelLocationsView()) + { + // Call + var closeForData = info.CloseForData(view, new object()); + + // Assert + Assert.IsFalse(closeForData); + } + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaveHeightLocationsViewInfoTest.cs =================================================================== diff -u -r88b44f34ed4dd17abbc44d54932215754cfd0601 -r90de5f60de0a152b946e686873ffb15cae3a7038 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaveHeightLocationsViewInfoTest.cs (.../WaveHeightLocationsViewInfoTest.cs) (revision 88b44f34ed4dd17abbc44d54932215754cfd0601) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaveHeightLocationsViewInfoTest.cs (.../WaveHeightLocationsViewInfoTest.cs) (revision 90de5f60de0a152b946e686873ffb15cae3a7038) @@ -126,9 +126,7 @@ { // Setup var mocks = new MockRepository(); - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); var assessmentSection = mocks.Stub(); - assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; IGui guiStub = mocks.Stub(); guiStub.Stub(g => g.ProjectOpened += null).IgnoreArguments(); @@ -139,6 +137,8 @@ mocks.ReplayAll(); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; var context = new WaveHeightLocationsContext(assessmentSection); using (var view = new WaveHeightLocationsView()) @@ -157,5 +157,83 @@ } mocks.VerifyAll(); } + + [Test] + public void CloseViewForData_ForMatchingAssessmentSection_ReturnsTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + using (var view = new WaveHeightLocationsView()) + { + view.AssessmentSection = assessmentSection; + + // Call + var closeForData = info.CloseForData(view, assessmentSection); + + // Assert + Assert.IsTrue(closeForData); + } + mocks.VerifyAll(); + } + + [Test] + public void CloseViewForData_ForNonMatchingAssessmentSection_ReturnsFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionA = mocks.Stub(); + var assessmentSectionB = mocks.Stub(); + mocks.ReplayAll(); + + using (var view = new WaveHeightLocationsView()) + { + view.AssessmentSection = assessmentSectionA; + + // Call + var closeForData = info.CloseForData(view, assessmentSectionB); + + // Assert + Assert.IsFalse(closeForData); + } + mocks.VerifyAll(); + } + + [Test] + public void CloseViewForData_ForOtherObjectType_ReturnsFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionA = mocks.Stub(); + mocks.ReplayAll(); + + using (var view = new WaveHeightLocationsView()) + { + view.Data = assessmentSectionA; + + // Call + var closeForData = info.CloseForData(view, new object()); + + // Assert + Assert.IsFalse(closeForData); + } + mocks.VerifyAll(); + } + + [Test] + public void CloseViewForData_ViewDataNull_ReturnsFalse() + { + // Setup + using (var view = new WaveHeightLocationsView()) + { + // Call + var closeForData = info.CloseForData(view, new object()); + + // Assert + Assert.IsFalse(closeForData); + } + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/test-data/copyOfCompleteWithLocationsToBeFilteredOut.sqlite =================================================================== diff -u Binary files differ