Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -rec9f45c99b375218d00a89df1ac1e187ebf54070 -r3014d0ced22c45300938639e7958ea0850485240 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision ec9f45c99b375218d00a89df1ac1e187ebf54070) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -81,7 +81,7 @@ - + RingtoetsEntities.tt Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs =================================================================== diff -u -r03a263822252a5020135a7de96ea8e50d5eb5cc6 -r3014d0ced22c45300938639e7958ea0850485240 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs (.../AssessmentSectionCreateExtensions.cs) (revision 03a263822252a5020135a7de96ea8e50d5eb5cc6) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs (.../AssessmentSectionCreateExtensions.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -78,7 +78,12 @@ AddEntityForHydraulicDatabase(section, entity, registry); AddEntityForReferenceLine(section, entity); - entity.BackgroundMapDataEntities.Add(section.BackgroundMapData.Create()); + // TODO: WTI-1141 + BackgroundMapDataEntity backgroundMapDataEntity = section.BackgroundMapData.Create(); + if (backgroundMapDataEntity != null) + { + entity.BackgroundMapDataEntities.Add(backgroundMapDataEntity); + } entity.FailureMechanismEntities.Add(section.PipingFailureMechanism.Create(registry)); entity.FailureMechanismEntities.Add(section.GrassCoverErosionInwards.Create(registry)); Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/BackgroundMapDataContainerCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/BackgroundMapDataContainerCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/BackgroundMapDataContainerCreateExtensions.cs (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -0,0 +1,89 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Core.Common.Utils.Extensions; +using Core.Components.Gis.Data; +using Ringtoets.Common.Data; + +namespace Application.Ringtoets.Storage.Create +{ + /// + /// Extensions methods for related to + /// creating a . + /// + internal static class BackgroundMapDataContainerCreateExtensions + { + /// + /// Creates a based on the information of the + /// and it's . + /// + /// The container to create a for. + /// The entity, or null if contains + /// an unsupported instance. + internal static BackgroundMapDataEntity Create(this BackgroundMapDataContainer mapDataContainer) + { + if (mapDataContainer == null) + { + throw new ArgumentNullException(nameof(mapDataContainer)); + } + var wmtsMapData = mapDataContainer.MapData as WmtsMapData; + if (wmtsMapData != null) + { + return wmtsMapData.Create(); + } + return null; // TODO: WTI-1141 + } + + /// + /// Creates a based on the information of the + /// + /// The to create a + /// for. + /// A configured . + /// Thrown when + /// is null. + internal static BackgroundMapDataEntity Create(this WmtsMapData mapData) + { + if (mapData == null) + { + throw new ArgumentNullException(nameof(mapData)); + } + + var entity = new BackgroundMapDataEntity + { + Name = mapData.Name.DeepClone(), + IsVisible = Convert.ToByte(mapData.IsVisible), + Transparency = mapData.Transparency + }; + + if (mapData.IsConfigured) + { + entity.SelectedCapabilityName = mapData.SelectedCapabilityIdentifier.DeepClone(); + entity.SourceCapabilitiesUrl = mapData.SourceCapabilitiesUrl.DeepClone(); + entity.PreferredFormat = mapData.PreferredFormat.DeepClone(); + } + + return entity; + } + } +} \ No newline at end of file Fisheye: Tag 3014d0ced22c45300938639e7958ea0850485240 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/BackgroundMapDataCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs =================================================================== diff -u -r9046346e9f7d535ae1dc2c774e0eb27c2accf174 -r3014d0ced22c45300938639e7958ea0850485240 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs (.../AssessmentSectionEntityReadExtensions.cs) (revision 9046346e9f7d535ae1dc2c774e0eb27c2accf174) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs (.../AssessmentSectionEntityReadExtensions.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -25,6 +25,7 @@ using Application.Ringtoets.Storage.Serializers; using Core.Common.Base.Geometry; using Core.Components.Gis.Data; +using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Hydraulics; @@ -109,19 +110,11 @@ private static void ReadBackgroundMapData(this AssessmentSectionEntity entity, IAssessmentSection assessmentSection) { - WmtsMapData backgroundMapData = entity.BackgroundMapDataEntities.Single().Read(); + BackgroundMapDataContainer container = entity.BackgroundMapDataEntities.Single().Read(); - assessmentSection.BackgroundMapData.Name = backgroundMapData.Name; - - if (backgroundMapData.IsConfigured) - { - assessmentSection.BackgroundMapData.Configure(backgroundMapData.SourceCapabilitiesUrl, - backgroundMapData.SelectedCapabilityIdentifier, - backgroundMapData.PreferredFormat); - } - - assessmentSection.BackgroundMapData.IsVisible = backgroundMapData.IsVisible; - assessmentSection.BackgroundMapData.Transparency = backgroundMapData.Transparency; + assessmentSection.BackgroundMapData.IsVisible = container.IsVisible; + assessmentSection.BackgroundMapData.Transparency = container.Transparency; + assessmentSection.BackgroundMapData.MapData = container.MapData; } private static void ReadReferenceLine(this AssessmentSectionEntity entity, IAssessmentSection assessmentSection) Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/BackgroundMapDataEntityReadExtensions.cs =================================================================== diff -u -r9046346e9f7d535ae1dc2c774e0eb27c2accf174 -r3014d0ced22c45300938639e7958ea0850485240 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/BackgroundMapDataEntityReadExtensions.cs (.../BackgroundMapDataEntityReadExtensions.cs) (revision 9046346e9f7d535ae1dc2c774e0eb27c2accf174) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/BackgroundMapDataEntityReadExtensions.cs (.../BackgroundMapDataEntityReadExtensions.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -23,42 +23,51 @@ using Application.Ringtoets.Storage.DbContext; using Core.Common.Base.Data; using Core.Components.Gis.Data; +using Ringtoets.Common.Data; namespace Application.Ringtoets.Storage.Read { /// - /// Extension methods for read operations for + /// Extension methods for read operations for /// based on the . /// internal static class BackgroundMapDataEntityReadExtensions { /// /// Read the and use the information - /// to construct a . + /// to construct a . /// /// The - /// to create for. + /// to create for. /// A new . /// Thrown when /// is null. - internal static WmtsMapData Read(this BackgroundMapDataEntity entity) + internal static BackgroundMapDataContainer Read(this BackgroundMapDataEntity entity) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } + var container = new BackgroundMapDataContainer + { + IsVisible = Convert.ToBoolean(entity.IsVisible), + Transparency = (RoundedDouble) entity.Transparency, + MapData = CreateMapData(entity) + }; + + return container; + } + + private static WmtsMapData CreateMapData(BackgroundMapDataEntity entity) + { var mapData = WmtsMapData.CreateUnconnectedMapData(); mapData.Name = entity.Name; if (entity.SourceCapabilitiesUrl != null && entity.SelectedCapabilityName != null && entity.PreferredFormat != null) { mapData.Configure(entity.SourceCapabilitiesUrl, entity.SelectedCapabilityName, entity.PreferredFormat); } - - mapData.IsVisible = Convert.ToBoolean(entity.IsVisible); - mapData.Transparency = (RoundedDouble)entity.Transparency; - return mapData; } } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -rec9f45c99b375218d00a89df1ac1e187ebf54070 -r3014d0ced22c45300938639e7958ea0850485240 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision ec9f45c99b375218d00a89df1ac1e187ebf54070) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -78,7 +78,7 @@ Properties\GlobalAssembly.cs - + Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/AssessmentSectionCreateExtensionsTest.cs =================================================================== diff -u -r03a263822252a5020135a7de96ea8e50d5eb5cc6 -r3014d0ced22c45300938639e7958ea0850485240 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/AssessmentSectionCreateExtensionsTest.cs (.../AssessmentSectionCreateExtensionsTest.cs) (revision 03a263822252a5020135a7de96ea8e50d5eb5cc6) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/AssessmentSectionCreateExtensionsTest.cs (.../AssessmentSectionCreateExtensionsTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -83,7 +83,10 @@ }, BackgroundMapData = { - Name = mapDataName, + MapData = + { + Name = mapDataName + }, Transparency = (RoundedDouble) transparency, IsVisible = isVisible } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/BackgroundMapDataContainerCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/BackgroundMapDataContainerCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/BackgroundMapDataContainerCreateExtensionsTest.cs (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -0,0 +1,177 @@ +// 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 Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.DbContext; +using Core.Common.Base.Data; +using Core.Components.Gis.Data; +using NUnit.Framework; +using Ringtoets.Common.Data; + +namespace Application.Ringtoets.Storage.Test.Create +{ + [TestFixture] + public class BackgroundMapDataContainerCreateExtensionsTest + { + [Test] + public void Create_BackgroundMapDataContainerNull_ThrowArgumentNullException() + { + // Setup + BackgroundMapDataContainer container = null; + + // Call + TestDelegate test = () => container.Create(); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("mapDataContainer", exception.ParamName); + } + + + [Test] + public void Create_BackgroundMapDataContainerWithWmtsMapData_ReturnsBackgroundMapDataEntity() + { + // Setup + const string name = "background"; + const string sourceCapabilitiesUrl = "//url"; + const string selectedCapabilityName = "selectedName"; + const string preferredFormat = "image/png"; + const bool isVisible = true; + RoundedDouble transparancy = (RoundedDouble)0.3; + + var mapData = new WmtsMapData(name, sourceCapabilitiesUrl, selectedCapabilityName, preferredFormat) + { + IsVisible = isVisible, + Transparency = transparancy + }; + + var container = new BackgroundMapDataContainer + { + IsVisible = isVisible, + Transparency = transparancy, + MapData = mapData + }; + + // Call + BackgroundMapDataEntity entity = container.Create(); + + // Assert + Assert.AreEqual(name, entity.Name); + Assert.AreEqual(sourceCapabilitiesUrl, entity.SourceCapabilitiesUrl); + Assert.AreEqual(selectedCapabilityName, entity.SelectedCapabilityName); + Assert.AreEqual(preferredFormat, entity.PreferredFormat); + Assert.AreEqual(Convert.ToByte(isVisible), entity.IsVisible); + Assert.AreEqual(transparancy, entity.Transparency); + } + + [Test] + public void Create_BackgroundMapDataContainerWithoutMapData_ReturnsNull() + { + // Setup + var container = new BackgroundMapDataContainer(); + + // Call + BackgroundMapDataEntity entity = container.Create(); + + // Assert + Assert.IsNull(entity); // TODO: WTI-1141 + } + + + [Test] + public void Create_BackgroundMapDataContainerWithWellKnownTileSource_ReturnsNull() + { + // Setup + var container = new BackgroundMapDataContainer + { + MapData = new WellKnownTileSourceMapData(WellKnownTileSource.BingAerial) + }; + + // Call + BackgroundMapDataEntity entity = container.Create(); + + // Assert + Assert.IsNull(entity); // TODO: WTI-1141 + } + + [Test] + public void Create_WmtsMapDataNull_ThrowArgumentNullException() + { + // Setup + WmtsMapData mapData = null; + + // Call + TestDelegate test = () => mapData.Create(); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("mapData", exception.ParamName); + } + + [Test] + public void Create_ConfiguredWmtsMapData_ReturnBackgroundMapDataEntity() + { + // Setup + const string name = "background"; + const string sourceCapabilitiesUrl = "//url"; + const string selectedCapabilityName = "selectedName"; + const string preferredFormat = "image/png"; + const bool isVisible = true; + RoundedDouble transparancy = (RoundedDouble) 0.3; + + var mapData = new WmtsMapData(name, sourceCapabilitiesUrl, selectedCapabilityName, preferredFormat) + { + IsVisible = isVisible, + Transparency = transparancy + }; + + // Call + BackgroundMapDataEntity entity = mapData.Create(); + + // Assert + Assert.AreEqual(name, entity.Name); + Assert.AreEqual(sourceCapabilitiesUrl, entity.SourceCapabilitiesUrl); + Assert.AreEqual(selectedCapabilityName, entity.SelectedCapabilityName); + Assert.AreEqual(preferredFormat, entity.PreferredFormat); + Assert.AreEqual(Convert.ToByte(isVisible), entity.IsVisible); + Assert.AreEqual(transparancy, entity.Transparency); + } + + [Test] + public void Create_UnconfiguredWmtsMapData_ReturnBackgroundMapDataEntity() + { + // Setup + var mapData = WmtsMapData.CreateUnconnectedMapData(); + + // Call + BackgroundMapDataEntity entity = mapData.Create(); + + // Assert + Assert.AreEqual(mapData.Name, entity.Name); + Assert.IsNull(entity.SourceCapabilitiesUrl); + Assert.IsNull(entity.SelectedCapabilityName); + Assert.IsNull(entity.PreferredFormat); + Assert.AreEqual(Convert.ToByte(mapData.IsVisible), entity.IsVisible); + Assert.AreEqual(mapData.Transparency, entity.Transparency); + } + } +} \ No newline at end of file Fisheye: Tag 3014d0ced22c45300938639e7958ea0850485240 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/BackgroundMapDataCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs =================================================================== diff -u -rd6d1b03ce8dc3c4e6bba565a85ea310f6196adea -r3014d0ced22c45300938639e7958ea0850485240 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision d6d1b03ce8dc3c4e6bba565a85ea310f6196adea) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -34,6 +34,7 @@ using Core.Common.Gui.Forms.MainWindow; using Core.Common.Gui.Settings; using Core.Common.TestUtil; +using Core.Components.Gis.Data; using NUnit.Framework; using Ringtoets.ClosingStructures.Data; using Ringtoets.Common.Data; @@ -66,18 +67,6 @@ private const string tempExtension = ".temp"; private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Storage, "DatabaseFiles"); - [OneTimeTearDown] - public void TearDownTempRingtoetsFile() - { - IEnumerable filesToDelete = Directory.EnumerateFiles(testDataPath, "*.temp"); - - foreach (string fileToDelete in filesToDelete) - { - TearDownTempRingtoetsFile(fileToDelete); - } - Dispatcher.CurrentDispatcher.InvokeShutdown(); - } - [Test] public void SaveProjectAs_SaveAsNewFile_ProjectAsEntitiesInBothFiles() { @@ -221,6 +210,18 @@ } } + [OneTimeTearDown] + public void TearDownTempRingtoetsFile() + { + IEnumerable filesToDelete = Directory.EnumerateFiles(testDataPath, "*.temp"); + + foreach (string fileToDelete in filesToDelete) + { + TearDownTempRingtoetsFile(fileToDelete); + } + Dispatcher.CurrentDispatcher.InvokeShutdown(); + } + private static string GetRandomRingtoetsFile() { return Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Storage, "DatabaseFiles"), @@ -245,6 +246,7 @@ Assert.AreEqual(expectedAssessmentSection.Name, actualAssessmentSection.Name); AssertComments(expectedAssessmentSection.Comments, actualAssessmentSection.Comments); + AssertBackgroundMapDataContainer(expectedAssessmentSection.BackgroundMapData, actualAssessmentSection.BackgroundMapData); AssertHydraulicBoundaryDatabase(expectedAssessmentSection.HydraulicBoundaryDatabase, actualAssessmentSection.HydraulicBoundaryDatabase); AssertReferenceLine(expectedAssessmentSection.ReferenceLine, actualAssessmentSection.ReferenceLine); AssertPipingFailureMechanism(expectedAssessmentSection.PipingFailureMechanism, actualAssessmentSection.PipingFailureMechanism); @@ -1777,5 +1779,31 @@ } #endregion + + #region BackgroundMapDataContainer + + private static void AssertBackgroundMapDataContainer(BackgroundMapDataContainer expectedContainer, BackgroundMapDataContainer actualContainer) + { + Assert.AreEqual(expectedContainer.IsVisible, actualContainer.IsVisible); + Assert.AreEqual(expectedContainer.Transparency, actualContainer.Transparency); + + var expectedWmtsMapData = (WmtsMapData) expectedContainer.MapData; + var actualWmtsMapData = (WmtsMapData) actualContainer.MapData; + AssertWmtsMapData(expectedWmtsMapData, actualWmtsMapData); + } + + private static void AssertWmtsMapData(WmtsMapData expectedWmtsMapData, WmtsMapData actualWmtsMapData) + { + Assert.AreEqual(expectedWmtsMapData.Name, actualWmtsMapData.Name); + Assert.AreEqual(expectedWmtsMapData.IsVisible, actualWmtsMapData.IsVisible); + Assert.AreEqual(expectedWmtsMapData.Transparency, actualWmtsMapData.Transparency); + + Assert.AreEqual(expectedWmtsMapData.IsConfigured, actualWmtsMapData.IsConfigured); + Assert.AreEqual(expectedWmtsMapData.SourceCapabilitiesUrl, actualWmtsMapData.SourceCapabilitiesUrl); + Assert.AreEqual(expectedWmtsMapData.SelectedCapabilityIdentifier, actualWmtsMapData.SelectedCapabilityIdentifier); + Assert.AreEqual(expectedWmtsMapData.PreferredFormat, actualWmtsMapData.PreferredFormat); + } + + #endregion } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs =================================================================== diff -u -r946a4e9beadd7a27a313fba0c365be20646abdb7 -r3014d0ced22c45300938639e7958ea0850485240 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 946a4e9beadd7a27a313fba0c365be20646abdb7) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -30,6 +30,7 @@ using Core.Common.TestUtil; using Core.Components.Gis.Data; using NUnit.Framework; +using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.DikeProfiles; @@ -116,7 +117,7 @@ if (isConfigured) { - backgroundMapDataEntity.SourceCapabilitiesUrl = sourceCapabilitiesUrl; + backgroundMapDataEntity.SourceCapabilitiesUrl = sourceCapabilitiesUrl; backgroundMapDataEntity.SelectedCapabilityName = selectedCapabilityName; backgroundMapDataEntity.PreferredFormat = preferredFormat; } @@ -129,11 +130,13 @@ var section = entity.Read(collector); // Assert - WmtsMapData backgroundMapData = section.BackgroundMapData; + BackgroundMapDataContainer container = section.BackgroundMapData; + Assert.AreEqual(isVisible, container.IsVisible); + Assert.AreEqual(transparency, container.Transparency); + + var backgroundMapData = (WmtsMapData)container.MapData; Assert.AreEqual(isConfigured, backgroundMapData.IsConfigured); Assert.AreEqual(mapDataName, backgroundMapData.Name); - Assert.AreEqual(isVisible, backgroundMapData.IsVisible); - Assert.AreEqual(transparency, backgroundMapData.Transparency); if (isConfigured) { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/BackgroundMapDataEntityReadExtensionsTest.cs =================================================================== diff -u -r03a263822252a5020135a7de96ea8e50d5eb5cc6 -r3014d0ced22c45300938639e7958ea0850485240 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/BackgroundMapDataEntityReadExtensionsTest.cs (.../BackgroundMapDataEntityReadExtensionsTest.cs) (revision 03a263822252a5020135a7de96ea8e50d5eb5cc6) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/BackgroundMapDataEntityReadExtensionsTest.cs (.../BackgroundMapDataEntityReadExtensionsTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Read; using Core.Components.Gis.Data; using NUnit.Framework; +using Ringtoets.Common.Data; namespace Application.Ringtoets.Storage.Test.Read { @@ -66,16 +67,18 @@ }; // Call - WmtsMapData mapData = entity.Read(); + BackgroundMapDataContainer container = entity.Read(); // Assert - Assert.AreEqual(name, mapData.Name); - Assert.AreEqual(url, mapData.SourceCapabilitiesUrl); - Assert.AreEqual(capabilityName, mapData.SelectedCapabilityIdentifier); - Assert.AreEqual(isVisible, mapData.IsVisible); - Assert.AreEqual(transparancy, mapData.Transparency.Value); - Assert.AreEqual(preferredFormat, mapData.PreferredFormat); - Assert.IsTrue(mapData.IsConfigured); + Assert.AreEqual(isVisible, container.IsVisible); + Assert.AreEqual(transparancy, container.Transparency.Value); + + var wmtsMapData = (WmtsMapData) container.MapData; + Assert.AreEqual(name, wmtsMapData.Name); + Assert.AreEqual(url, wmtsMapData.SourceCapabilitiesUrl); + Assert.AreEqual(capabilityName, wmtsMapData.SelectedCapabilityIdentifier); + Assert.AreEqual(preferredFormat, wmtsMapData.PreferredFormat); + Assert.IsTrue(wmtsMapData.IsConfigured); } [Test] @@ -94,16 +97,18 @@ }; // Call - WmtsMapData mapData = entity.Read(); + BackgroundMapDataContainer container = entity.Read(); // Assert - Assert.AreEqual(name, mapData.Name); - Assert.IsNull(mapData.SourceCapabilitiesUrl); - Assert.IsNull(mapData.SelectedCapabilityIdentifier); - Assert.AreEqual(isVisible, mapData.IsVisible); - Assert.AreEqual(transparancy, mapData.Transparency.Value); - Assert.IsNull(mapData.PreferredFormat); - Assert.IsFalse(mapData.IsConfigured); + Assert.AreEqual(isVisible, container.IsVisible); + Assert.AreEqual(transparancy, container.Transparency.Value); + + var wmtsMapData = (WmtsMapData)container.MapData; + Assert.AreEqual(name, wmtsMapData.Name); + Assert.IsNull(wmtsMapData.SourceCapabilitiesUrl); + Assert.IsNull(wmtsMapData.SelectedCapabilityIdentifier); + Assert.IsNull(wmtsMapData.PreferredFormat); + Assert.IsFalse(wmtsMapData.IsConfigured); } } } \ No newline at end of file Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs =================================================================== diff -u -r75c881f5a6ce68ef3fd30bcc15852d68b0bbe941 -r3014d0ced22c45300938639e7958ea0850485240 --- Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs (.../AddNewDemoAssessmentSectionCommand.cs) (revision 75c881f5a6ce68ef3fd30bcc15852d68b0bbe941) +++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs (.../AddNewDemoAssessmentSectionCommand.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -108,10 +108,14 @@ private static void InitializeBackgroundMapData(AssessmentSection demoAssessmentSection) { WmtsMapData targetConfiguration = WmtsMapData.CreateDefaultPdokMapData(); - demoAssessmentSection.BackgroundMapData.Name = targetConfiguration.Name; - demoAssessmentSection.BackgroundMapData.Configure(targetConfiguration.SourceCapabilitiesUrl, - targetConfiguration.SelectedCapabilityIdentifier, - targetConfiguration.PreferredFormat); + demoAssessmentSection.BackgroundMapData.IsVisible = targetConfiguration.IsVisible; + demoAssessmentSection.BackgroundMapData.Transparency = targetConfiguration.Transparency; + + var backgroundMapData = (WmtsMapData)demoAssessmentSection.BackgroundMapData.MapData; + backgroundMapData.Name = targetConfiguration.Name; + backgroundMapData.Configure(targetConfiguration.SourceCapabilitiesUrl, + targetConfiguration.SelectedCapabilityIdentifier, + targetConfiguration.PreferredFormat); } private void InitializeDemoReferenceLine(AssessmentSection demoAssessmentSection) Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs =================================================================== diff -u -r000b675444761bd16bc9aa7860c2af198b705bb0 -r3014d0ced22c45300938639e7958ea0850485240 --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs (.../AddNewDemoAssessmentSectionCommandTest.cs) (revision 000b675444761bd16bc9aa7860c2af198b705bb0) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs (.../AddNewDemoAssessmentSectionCommandTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -102,15 +102,17 @@ Assert.AreEqual("Demo traject", demoAssessmentSection.Name); Assert.AreEqual("6-3", demoAssessmentSection.Id); - WmtsMapData expectedWmtsMapData = WmtsMapData.CreateDefaultPdokMapData(); - Assert.IsTrue(demoAssessmentSection.BackgroundMapData.IsConfigured); Assert.IsTrue(demoAssessmentSection.BackgroundMapData.IsVisible); Assert.AreEqual(0.0, demoAssessmentSection.BackgroundMapData.Transparency.Value); - Assert.AreEqual(expectedWmtsMapData.Name, demoAssessmentSection.BackgroundMapData.Name); - Assert.AreEqual(expectedWmtsMapData.SourceCapabilitiesUrl, demoAssessmentSection.BackgroundMapData.SourceCapabilitiesUrl); - Assert.AreEqual(expectedWmtsMapData.SelectedCapabilityIdentifier, demoAssessmentSection.BackgroundMapData.SelectedCapabilityIdentifier); - Assert.AreEqual(expectedWmtsMapData.PreferredFormat, demoAssessmentSection.BackgroundMapData.PreferredFormat); + var mapData = (WmtsMapData)demoAssessmentSection.BackgroundMapData.MapData; + Assert.IsTrue(mapData.IsConfigured); + WmtsMapData expectedWmtsMapData = WmtsMapData.CreateDefaultPdokMapData(); + Assert.AreEqual(expectedWmtsMapData.Name, mapData.Name); + Assert.AreEqual(expectedWmtsMapData.SourceCapabilitiesUrl, mapData.SourceCapabilitiesUrl); + Assert.AreEqual(expectedWmtsMapData.SelectedCapabilityIdentifier, mapData.SelectedCapabilityIdentifier); + Assert.AreEqual(expectedWmtsMapData.PreferredFormat, mapData.PreferredFormat); + AssertHydraulicBoundaryDatabase(demoAssessmentSection); Assert.AreEqual(2380, demoAssessmentSection.ReferenceLine.Points.Count()); Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismView.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismView.cs (.../ClosingStructuresFailureMechanismView.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismView.cs (.../ClosingStructuresFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -149,7 +149,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = data.Parent.BackgroundMapData; + Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; } } } Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismViewTest.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismViewTest.cs (.../ClosingStructuresFailureMechanismViewTest.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismViewTest.cs (.../ClosingStructuresFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -29,7 +29,6 @@ using Core.Components.Gis.Forms; using Core.Components.Gis.Geometries; using NUnit.Framework; -using Rhino.Mocks; using Ringtoets.ClosingStructures.Data; using Ringtoets.ClosingStructures.Data.TestUtil; using Ringtoets.ClosingStructures.Forms.PresentationObjects; @@ -90,9 +89,7 @@ // Setup using (var view = new ClosingStructuresFailureMechanismView()) { - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new ClosingStructuresFailureMechanismContext( new ClosingStructuresFailureMechanism(), assessmentSection); @@ -102,8 +99,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); - - mockRepository.VerifyAll(); } } @@ -115,10 +110,13 @@ IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub { - BackgroundMapData = backgroundMapData + BackgroundMapData = + { + MapData = backgroundMapData + } }; - using(new UseCustomTileSourceFactoryConfig(backgroundMapData)) + using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) using (var view = new ClosingStructuresFailureMechanismView()) { var failureMechanismContext = new ClosingStructuresFailureMechanismContext( @@ -154,9 +152,7 @@ // Setup using (var view = new ClosingStructuresFailureMechanismView()) { - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new ClosingStructuresFailureMechanismContext( new ClosingStructuresFailureMechanism(), @@ -174,8 +170,6 @@ Assert.IsNull(view.Data); Assert.IsNull(view.Map.Data); Assert.IsNull(view.Map.BackgroundMapData); - - mockRepository.VerifyAll(); } } @@ -185,9 +179,7 @@ // Setup using (var view = new ClosingStructuresFailureMechanismView()) { - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new ClosingStructuresFailureMechanismContext( new ClosingStructuresFailureMechanism(), @@ -199,8 +191,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); AssertEmptyMapData(view.Map.Data); - - mockRepository.VerifyAll(); } } @@ -235,11 +225,11 @@ new Point2D(2.0, 1.0) }); - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSection = mockRepository.Stub(); - assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - assessmentSection.ReferenceLine = referenceLine; - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub + { + HydraulicBoundaryDatabase = hydraulicBoundaryDatabase, + ReferenceLine = referenceLine + }; var calculationLocationA = new Point2D(1.2, 2.3); var calculationLocationB = new Point2D(2.7, 2.0); @@ -306,8 +296,6 @@ AssertCalculationsMapData( failureMechanism.Calculations.Cast>(), mapDataList[calculationsIndex]); - - mockRepository.VerifyAll(); } } Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresFailureMechanismViewInfoTest.cs =================================================================== diff -u -rfb9bf56793b90226745888c194ba6ae760f83f4c -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresFailureMechanismViewInfoTest.cs (.../ClosingStructuresFailureMechanismViewInfoTest.cs) (revision fb9bf56793b90226745888c194ba6ae760f83f4c) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresFailureMechanismViewInfoTest.cs (.../ClosingStructuresFailureMechanismViewInfoTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -28,6 +28,7 @@ using Ringtoets.ClosingStructures.Forms.PresentationObjects; using Ringtoets.ClosingStructures.Forms.Views; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.TestUtil; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.ClosingStructures.Plugin.Test.ViewInfos @@ -86,7 +87,7 @@ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() { // Setup - var assessmentSection = mocks.Stub(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var otherAssessmentSection = mocks.Stub(); mocks.ReplayAll(); @@ -111,37 +112,34 @@ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanism = new ClosingStructuresFailureMechanism(); - var failureMechanismContext = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection); using (var view = new ClosingStructuresFailureMechanismView { Data = failureMechanismContext }) { // Call - bool closeForData = info.CloseForData(view, assessmentSectionStub); + bool closeForData = info.CloseForData(view, assessmentSection); // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanism = new ClosingStructuresFailureMechanism(); var otherClosingStructuresFailureMechanism = new ClosingStructuresFailureMechanism(); - var failureMechanismContext = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection); using (var view = new ClosingStructuresFailureMechanismView { @@ -154,18 +152,16 @@ // Assert Assert.IsFalse(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanism = new ClosingStructuresFailureMechanism(); - var failureMechanismContext = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection); using (var view = new ClosingStructuresFailureMechanismView { @@ -178,7 +174,6 @@ // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] Index: Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/IAssessmentSection.cs =================================================================== diff -u -r3722e29f53ce7db0f11fb184cdc2a76d33078cf2 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/IAssessmentSection.cs (.../IAssessmentSection.cs) (revision 3722e29f53ce7db0f11fb184cdc2a76d33078cf2) +++ Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/IAssessmentSection.cs (.../IAssessmentSection.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -70,9 +70,10 @@ HydraulicBoundaryDatabase HydraulicBoundaryDatabase { get; set; } /// - /// The layer that represents the background for all geo-referenced data. + /// Gets the containers that holds the layer that represents the background for all + /// geo-referenced data. /// - WmtsMapData BackgroundMapData { get; } + BackgroundMapDataContainer BackgroundMapData { get; } /// /// Gets the failure mechanisms corresponding to the assessment section. Index: Ringtoets/Common/src/Ringtoets.Common.Data/BackgroundMapDataContainer.cs =================================================================== diff -u -r9f3f7c10efcf38e5b49973744e52307ddda3c0f7 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Common/src/Ringtoets.Common.Data/BackgroundMapDataContainer.cs (.../BackgroundMapDataContainer.cs) (revision 9f3f7c10efcf38e5b49973744e52307ddda3c0f7) +++ Ringtoets/Common/src/Ringtoets.Common.Data/BackgroundMapDataContainer.cs (.../BackgroundMapDataContainer.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -32,30 +32,30 @@ public class BackgroundMapDataContainer { private readonly ImageBasedMapDataConfigurationHolder configuration = new ImageBasedMapDataConfigurationHolder(); - private ImageBasedMapData backgroundMapData; + private ImageBasedMapData mapData; /// /// The background . /// - public ImageBasedMapData BackgroundMapData + public ImageBasedMapData MapData { get { - return backgroundMapData; + return mapData; } set { - backgroundMapData = value; - if (backgroundMapData != null) + mapData = value; + if (mapData != null) { - backgroundMapData.IsVisible = IsVisible; - backgroundMapData.Transparency = Transparency; + mapData.IsVisible = IsVisible; + mapData.Transparency = Transparency; } } } /// - /// Gets or sets a value indicating whether the is visible. + /// Gets or sets a value indicating whether the is visible. /// public bool IsVisible { @@ -66,15 +66,15 @@ set { configuration.IsVisible = value; - if (backgroundMapData != null) + if (mapData != null) { - backgroundMapData.IsVisible = value; + mapData.IsVisible = value; } } } /// - /// Gets or sets the transparency of . + /// Gets or sets the transparency of . /// /// Thrown when setting a new value /// that is not in the range [0.0, 1.0]. @@ -87,9 +87,9 @@ set { configuration.Transparency = value; - if (backgroundMapData != null) + if (mapData != null) { - backgroundMapData.Transparency = value; + mapData.Transparency = value; } } } Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismView.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismView.cs (.../FailureMechanismView.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismView.cs (.../FailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -116,7 +116,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = data.Parent.BackgroundMapData; + Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; } } } Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/BackgroundMapDataContainerTest.cs =================================================================== diff -u -r9f3f7c10efcf38e5b49973744e52307ddda3c0f7 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/BackgroundMapDataContainerTest.cs (.../BackgroundMapDataContainerTest.cs) (revision 9f3f7c10efcf38e5b49973744e52307ddda3c0f7) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/BackgroundMapDataContainerTest.cs (.../BackgroundMapDataContainerTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -38,7 +38,7 @@ var container = new BackgroundMapDataContainer(); // Assert - Assert.IsNull(container.BackgroundMapData); + Assert.IsNull(container.MapData); Assert.IsTrue(container.IsVisible); Assert.AreEqual(2, container.Transparency.NumberOfDecimalPlaces); Assert.AreEqual(0, container.Transparency.Value); @@ -54,23 +54,22 @@ var container = new BackgroundMapDataContainer(); // Call - container.Transparency = (RoundedDouble)newValue; + container.Transparency = (RoundedDouble) newValue; // Assert Assert.AreEqual(newValue, container.Transparency); } - [Test] - public void Transparency_WithBackgroundMapData_MapDataTransparencyUpdated() + public void Transparency_WithMapData_MapDataTransparencyUpdated() { // Setup var mocks = new MockRepository(); var backgroundMapData = mocks.Stub("A"); mocks.ReplayAll(); var container = new BackgroundMapDataContainer(); - container.BackgroundMapData = backgroundMapData; + container.MapData = backgroundMapData; // Call container.Transparency = (RoundedDouble) 0.5; @@ -92,15 +91,14 @@ var container = new BackgroundMapDataContainer(); // Call - TestDelegate call = () => container.Transparency = (RoundedDouble)invalidTransparency; + TestDelegate call = () => container.Transparency = (RoundedDouble) invalidTransparency; // Assert var message = "De transparantie moet in het bereik [0.0, 1.0] liggen."; string paramName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message).ParamName; Assert.AreEqual("value", paramName); } - [Test] [TestCase(true)] [TestCase(false)] @@ -116,11 +114,10 @@ Assert.AreEqual(newValue, container.IsVisible); } - [Test] [TestCase(true)] [TestCase(false)] - public void IsVisible_WithBackgroundMapData_MapDataIsVisibleUpdated(bool isVisible) + public void IsVisible_WithMapData_MapDataIsVisibleUpdated(bool isVisible) { // Setup var mocks = new MockRepository(); @@ -129,7 +126,7 @@ var container = new BackgroundMapDataContainer { - BackgroundMapData = imageBasedMapData + MapData = imageBasedMapData }; // Call @@ -143,7 +140,7 @@ [Test] [TestCase(true, 0.5)] [TestCase(false, 0.8)] - public void BackgroundMapData_SetNewValue_GetNewValueAndInitializePreconfiguration(bool isVisible, double transparency) + public void MapData_SetNewValue_GetNewValueAndInitializePreconfiguration(bool isVisible, double transparency) { // Setup var mocks = new MockRepository(); @@ -153,16 +150,16 @@ var container = new BackgroundMapDataContainer { IsVisible = isVisible, - Transparency = (RoundedDouble)transparency + Transparency = (RoundedDouble) transparency }; // Call - container.BackgroundMapData = imageBasedMapData; + container.MapData = imageBasedMapData; // Assert Assert.AreEqual(container.Transparency, imageBasedMapData.Transparency); Assert.AreEqual(container.IsVisible, imageBasedMapData.IsVisible); - Assert.AreSame(imageBasedMapData, container.BackgroundMapData); + Assert.AreSame(imageBasedMapData, container.MapData); mocks.VerifyAll(); } } Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/ObservableTestAssessmentSectionStubTest.cs =================================================================== diff -u -r000b675444761bd16bc9aa7860c2af198b705bb0 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/ObservableTestAssessmentSectionStubTest.cs (.../ObservableTestAssessmentSectionStubTest.cs) (revision 000b675444761bd16bc9aa7860c2af198b705bb0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/ObservableTestAssessmentSectionStubTest.cs (.../ObservableTestAssessmentSectionStubTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -49,7 +49,7 @@ Assert.AreEqual(0, Convert.ToInt32(assessmentSection.Composition)); Assert.IsNull(assessmentSection.ReferenceLine); Assert.IsNull(assessmentSection.HydraulicBoundaryDatabase); - Assert.IsNull(assessmentSection.BackgroundMapData); + Assert.IsNull(assessmentSection.BackgroundMapData.MapData); Assert.AreEqual(1.0 / 300000.0, assessmentSection.FailureMechanismContribution.Norm); FailureMechanismContributionItem[] contributionItems = assessmentSection.FailureMechanismContribution.Distribution.ToArray(); Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/ObservableTestAssessmentSectionStub.cs =================================================================== diff -u -r000b675444761bd16bc9aa7860c2af198b705bb0 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/ObservableTestAssessmentSectionStub.cs (.../ObservableTestAssessmentSectionStub.cs) (revision 000b675444761bd16bc9aa7860c2af198b705bb0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/ObservableTestAssessmentSectionStub.cs (.../ObservableTestAssessmentSectionStub.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -40,6 +40,7 @@ public ObservableTestAssessmentSectionStub() { FailureMechanismContribution = new FailureMechanismContribution(Enumerable.Empty(), 0, 1.0/300000); + BackgroundMapData = new BackgroundMapDataContainer(); } public string Id { get; } @@ -49,7 +50,7 @@ public ReferenceLine ReferenceLine { get; set; } public FailureMechanismContribution FailureMechanismContribution { get; } public HydraulicBoundaryDatabase HydraulicBoundaryDatabase { get; set; } - public WmtsMapData BackgroundMapData { get; set; } + public BackgroundMapDataContainer BackgroundMapData { get; } public IEnumerable GetFailureMechanisms() { Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismViewTest.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismViewTest.cs (.../FailureMechanismViewTest.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismViewTest.cs (.../FailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -101,7 +101,10 @@ IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub { - BackgroundMapData = backgroundMapData + BackgroundMapData = + { + MapData = backgroundMapData + } }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismView.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismView.cs (.../DuneErosionFailureMechanismView.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismView.cs (.../DuneErosionFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -106,7 +106,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = data.Parent.BackgroundMapData; + Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; } } } Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneErosionFailureMechanismViewTest.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneErosionFailureMechanismViewTest.cs (.../DuneErosionFailureMechanismViewTest.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneErosionFailureMechanismViewTest.cs (.../DuneErosionFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -85,9 +85,7 @@ { var failureMechanism = new DuneErosionFailureMechanism(); - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new DuneErosionFailureMechanismContext(failureMechanism, assessmentSection); @@ -97,8 +95,6 @@ // Assert Assert.AreEqual(failureMechanism.Name, view.Map.Data.Name); Assert.AreSame(failureMechanismContext, view.Data); - - mockRepository.VerifyAll(); } } @@ -126,7 +122,10 @@ IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub { - BackgroundMapData = backgroundMapData + BackgroundMapData = + { + MapData = backgroundMapData + } }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) @@ -148,9 +147,7 @@ // Setup using (var view = new DuneErosionFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new DuneErosionFailureMechanismContext(new DuneErosionFailureMechanism(), assessmentSection); @@ -166,8 +163,6 @@ Assert.IsNull(view.Data); Assert.IsNull(view.Map.Data); Assert.IsNull(view.Map.BackgroundMapData); - - mockRepository.VerifyAll(); } } @@ -177,9 +172,7 @@ // Setup using (var view = new DuneErosionFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new DuneErosionFailureMechanismContext(new DuneErosionFailureMechanism(), assessmentSection); @@ -189,8 +182,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); AssertEmptyMapData(view.Map.Data); - - mockRepository.VerifyAll(); } } @@ -217,10 +208,10 @@ new Point2D(2.0, 1.0) }); - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - assessmentSection.ReferenceLine = referenceLine; - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub + { + ReferenceLine = referenceLine + }; var failureMechanism = new DuneErosionFailureMechanism { @@ -251,8 +242,6 @@ MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); AssertDuneLocationsMapData(failureMechanism.DuneLocations, mapDataList[duneLocationsIndex]); - - mockRepository.VerifyAll(); } } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismView.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismView.cs (.../GrassCoverErosionInwardsFailureMechanismView.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismView.cs (.../GrassCoverErosionInwardsFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -144,7 +144,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = data.Parent.BackgroundMapData; + Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; } } } Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismViewTest.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismViewTest.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -28,7 +28,6 @@ using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; -using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.FailureMechanism; @@ -87,9 +86,7 @@ // Setup using (var view = new GrassCoverErosionInwardsFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(new GrassCoverErosionInwardsFailureMechanism(), assessmentSection); @@ -98,8 +95,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); - - mockRepository.VerifyAll(); } } @@ -127,7 +122,10 @@ IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub { - BackgroundMapData = backgroundMapData + BackgroundMapData = + { + MapData = backgroundMapData + } }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) @@ -149,9 +147,7 @@ // Setup using (var view = new GrassCoverErosionInwardsFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(new GrassCoverErosionInwardsFailureMechanism(), assessmentSection); @@ -167,8 +163,6 @@ Assert.IsNull(view.Data); Assert.IsNull(view.Map.Data); Assert.IsNull(view.Map.BackgroundMapData); - - mockRepository.VerifyAll(); } } @@ -178,9 +172,7 @@ // Setup using (var view = new GrassCoverErosionInwardsFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(new GrassCoverErosionInwardsFailureMechanism(), assessmentSection); @@ -190,8 +182,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); AssertEmptyMapData(view.Map.Data); - - mockRepository.VerifyAll(); } } @@ -226,11 +216,11 @@ new Point2D(2.0, 1.0) }); - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - assessmentSection.ReferenceLine = referenceLine; - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub + { + HydraulicBoundaryDatabase = hydraulicBoundaryDatabase, + ReferenceLine = referenceLine + }; var dikeProfileA = new TestDikeProfile(new Point2D(1.3, 1.3)); var dikeProfileB = new TestDikeProfile(new Point2D(1.5, 1.5)); @@ -258,15 +248,15 @@ failureMechanism.AddSection(new FailureMechanismSection("C", geometryPoints.Skip(2).Take(2))); failureMechanism.DikeProfiles.Add(new TestDikeProfile(new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); + { + new Point2D(0, 0), + new Point2D(1, 1) + })); failureMechanism.DikeProfiles.Add(new TestDikeProfile(new[] - { - new Point2D(2, 2), - new Point2D(3, 3) - })); + { + new Point2D(2, 2), + new Point2D(3, 3) + })); failureMechanism.CalculationsGroup.Children.Add(calculationA); failureMechanism.CalculationsGroup.Children.Add(calculationB); @@ -291,8 +281,6 @@ AssertDikeProfiles(failureMechanism.DikeProfiles, mapDataList[dikeProfilesIndex]); MapDataTestHelper.AssertForeshoreProfilesMapData(failureMechanism.DikeProfiles.Select(dp => dp.ForeshoreProfile), mapDataList[foreshoreProfilesIndex]); AssertCalculationsMapData(failureMechanism.Calculations.Cast(), mapDataList[calculationsIndex]); - - mockRepository.VerifyAll(); } } @@ -549,10 +537,10 @@ var failureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(failureMechanism, new ObservableTestAssessmentSectionStub()); failureMechanism.DikeProfiles.Add(new TestDikeProfile(new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); + { + new Point2D(0, 0), + new Point2D(1, 1) + })); view.Data = failureMechanismContext; @@ -562,10 +550,10 @@ MapDataTestHelper.AssertForeshoreProfilesMapData(failureMechanism.DikeProfiles.Select(dp => dp.ForeshoreProfile), dikeProfileData); failureMechanism.DikeProfiles.Add(new TestDikeProfile(new[] - { - new Point2D(2, 2), - new Point2D(3, 3) - })); + { + new Point2D(2, 2), + new Point2D(3, 3) + })); // Call failureMechanism.DikeProfiles.NotifyObservers(); @@ -856,10 +844,10 @@ GrassCoverErosionInwardsCalculation calculation = calculationsArray[index]; CollectionAssert.AreEquivalent(new[] - { - calculation.InputParameters.DikeProfile.WorldReferencePoint, - calculation.InputParameters.HydraulicBoundaryLocation.Location - }, + { + calculation.InputParameters.DikeProfile.WorldReferencePoint, + calculation.InputParameters.HydraulicBoundaryLocation.Location + }, geometries[0].PointCollections.First()); } Assert.AreEqual("Berekeningen", mapData.Name); Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ViewInfos/GrassCoverErosionInwardsFailureMechanismViewInfoTest.cs =================================================================== diff -u -rfb9bf56793b90226745888c194ba6ae760f83f4c -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ViewInfos/GrassCoverErosionInwardsFailureMechanismViewInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismViewInfoTest.cs) (revision fb9bf56793b90226745888c194ba6ae760f83f4c) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ViewInfos/GrassCoverErosionInwardsFailureMechanismViewInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismViewInfoTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -25,6 +25,7 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.GrassCoverErosionInwards.Data; using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionInwards.Forms.Views; @@ -88,7 +89,7 @@ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() { // Setup - var assessmentSection = mocks.Stub(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var otherAssessmentSection = mocks.Stub(); mocks.ReplayAll(); @@ -113,37 +114,35 @@ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var grassCoverErosionInwardsFailureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - var grassCoverErosionInwardsFailureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(grassCoverErosionInwardsFailureMechanism, assessmentSectionStub); + var grassCoverErosionInwardsFailureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(grassCoverErosionInwardsFailureMechanism, assessmentSection); using (var view = new GrassCoverErosionInwardsFailureMechanismView { Data = grassCoverErosionInwardsFailureMechanismContext }) { // Call - bool closeForData = info.CloseForData(view, assessmentSectionStub); + bool closeForData = info.CloseForData(view, assessmentSection); // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); mocks.ReplayAll(); var grassCoverErosionInwardsFailureMechanism = new GrassCoverErosionInwardsFailureMechanism(); var otherGrassCoverErosionInwardsFailureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - var grassCoverErosionInwardsFailureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(grassCoverErosionInwardsFailureMechanism, assessmentSectionStub); + var grassCoverErosionInwardsFailureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(grassCoverErosionInwardsFailureMechanism, assessmentSection); using (var view = new GrassCoverErosionInwardsFailureMechanismView { @@ -156,18 +155,16 @@ // Assert Assert.IsFalse(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var grassCoverErosionInwardsFailureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - var grassCoverErosionInwardsFailureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(grassCoverErosionInwardsFailureMechanism, assessmentSectionStub); + var grassCoverErosionInwardsFailureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(grassCoverErosionInwardsFailureMechanism, assessmentSection); using (var view = new GrassCoverErosionInwardsFailureMechanismView { @@ -180,7 +177,6 @@ // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismView.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismView.cs (.../GrassCoverErosionOutwardsFailureMechanismView.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismView.cs (.../GrassCoverErosionOutwardsFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -134,7 +134,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = data.Parent.BackgroundMapData; + Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; } } } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismViewTest.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismViewTest.cs (.../GrassCoverErosionOutwardsFailureMechanismViewTest.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismViewTest.cs (.../GrassCoverErosionOutwardsFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -28,7 +28,6 @@ using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; -using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Hydraulics; @@ -85,9 +84,7 @@ // Setup using (var view = new GrassCoverErosionOutwardsFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext(new GrassCoverErosionOutwardsFailureMechanism(), assessmentSection); @@ -96,8 +93,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); - - mockRepository.VerifyAll(); } } @@ -125,7 +120,10 @@ IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub { - BackgroundMapData = backgroundMapData + BackgroundMapData = + { + MapData = backgroundMapData + } }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) @@ -148,9 +146,7 @@ // Setup using (var view = new GrassCoverErosionOutwardsFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext( new GrassCoverErosionOutwardsFailureMechanism(), assessmentSection); @@ -167,8 +163,6 @@ Assert.IsNull(view.Data); Assert.IsNull(view.Map.Data); Assert.IsNull(view.Map.BackgroundMapData); - - mockRepository.VerifyAll(); } } @@ -178,9 +172,7 @@ // Setup using (var view = new GrassCoverErosionOutwardsFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext( new GrassCoverErosionOutwardsFailureMechanism(), assessmentSection); @@ -191,8 +183,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); AssertEmptyMapData(view.Map.Data); - - mockRepository.VerifyAll(); } } @@ -214,16 +204,16 @@ var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] - { - new Point2D(1.0, 2.0), - new Point2D(2.0, 1.0) - }); + { + new Point2D(1.0, 2.0), + new Point2D(2.0, 1.0) + }); - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - assessmentSection.ReferenceLine = referenceLine; - mockRepository.ReplayAll(); - + var assessmentSection = new ObservableTestAssessmentSectionStub + { + ReferenceLine = referenceLine + }; + var foreshoreProfileA = new TestForeshoreProfile(new Point2D(1.3, 1.3)); var foreshoreProfileB = new TestForeshoreProfile(new Point2D(1.5, 1.5)); @@ -250,15 +240,15 @@ failureMechanism.AddSection(new FailureMechanismSection("C", geometryPoints.Skip(2).Take(2))); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); + { + new Point2D(0, 0), + new Point2D(1, 1) + })); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(2, 2), - new Point2D(3, 3) - })); + { + new Point2D(2, 2), + new Point2D(3, 3) + })); failureMechanism.WaveConditionsCalculationGroup.Children.Add(calculationA); failureMechanism.WaveConditionsCalculationGroup.Children.Add(calculationB); failureMechanism.HydraulicBoundaryLocations.Add(new HydraulicBoundaryLocation(1, "test", 1.0, 2.0)); @@ -284,8 +274,6 @@ MapDataTestHelper.AssertForeshoreProfilesMapData(failureMechanism.ForeshoreProfiles, mapDataList[foreshoreProfilesIndex]); AssertCalculationsMapData(failureMechanism.Calculations.Cast(), mapDataList[calculationsIndex]); - - mockRepository.VerifyAll(); } } @@ -386,10 +374,10 @@ // Call failureMechanism.AddSection(new FailureMechanismSection(string.Empty, new[] - { - new Point2D(1, 2), - new Point2D(1, 2) - })); + { + new Point2D(1, 2), + new Point2D(1, 2) + })); failureMechanism.NotifyObservers(); // Assert @@ -411,10 +399,10 @@ var failureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext(failureMechanism, new ObservableTestAssessmentSectionStub()); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); + { + new Point2D(0, 0), + new Point2D(1, 1) + })); view.Data = failureMechanismContext; @@ -425,10 +413,10 @@ // Call failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(2, 2), - new Point2D(3, 3) - })); + { + new Point2D(2, 2), + new Point2D(3, 3) + })); failureMechanism.ForeshoreProfiles.NotifyObservers(); // Assert @@ -651,10 +639,10 @@ newAssessmentSection.ReferenceLine = new ReferenceLine(); newAssessmentSection.ReferenceLine.SetGeometry(new[] - { - new Point2D(2, 4), - new Point2D(3, 4) - }); + { + new Point2D(2, 4), + new Point2D(3, 4) + }); var oldGrassCoverErosionOutwardsFailureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext(new GrassCoverErosionOutwardsFailureMechanism(), oldAssessmentSection); var newGrassCoverErosionOutwardsFailureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext(new GrassCoverErosionOutwardsFailureMechanism(), newAssessmentSection); Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsFailureMechanismViewInfoTest.cs =================================================================== diff -u -r8e2eb144317c011c15783e8e850c9253d550450e -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsFailureMechanismViewInfoTest.cs (.../GrassCoverErosionOutwardsFailureMechanismViewInfoTest.cs) (revision 8e2eb144317c011c15783e8e850c9253d550450e) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsFailureMechanismViewInfoTest.cs (.../GrassCoverErosionOutwardsFailureMechanismViewInfoTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -25,6 +25,7 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.GrassCoverErosionOutwards.Data; using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionOutwards.Forms.Views; @@ -88,7 +89,7 @@ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() { // Setup - var assessmentSection = mocks.Stub(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var otherAssessmentSection = mocks.Stub(); mocks.ReplayAll(); @@ -113,37 +114,34 @@ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var grassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); - var grassCoverErosionOutwardsFailureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext(grassCoverErosionOutwardsFailureMechanism, assessmentSectionStub); + var grassCoverErosionOutwardsFailureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext(grassCoverErosionOutwardsFailureMechanism, assessmentSection); using (var view = new GrassCoverErosionOutwardsFailureMechanismView { Data = grassCoverErosionOutwardsFailureMechanismContext }) { // Call - bool closeForData = info.CloseForData(view, assessmentSectionStub); + bool closeForData = info.CloseForData(view, assessmentSection); // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var grassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); var otherGrassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); - var grassCoverErosionOutwardsFailureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext(grassCoverErosionOutwardsFailureMechanism, assessmentSectionStub); + var grassCoverErosionOutwardsFailureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext(grassCoverErosionOutwardsFailureMechanism, assessmentSection); using (var view = new GrassCoverErosionOutwardsFailureMechanismView { @@ -156,18 +154,16 @@ // Assert Assert.IsFalse(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var grassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); - var grassCoverErosionOutwardsFailureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext(grassCoverErosionOutwardsFailureMechanism, assessmentSectionStub); + var grassCoverErosionOutwardsFailureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext(grassCoverErosionOutwardsFailureMechanism, assessmentSection); using (var view = new GrassCoverErosionOutwardsFailureMechanismView { @@ -180,7 +176,6 @@ // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismView.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismView.cs (.../HeightStructuresFailureMechanismView.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismView.cs (.../HeightStructuresFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -150,7 +150,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = data.Parent.BackgroundMapData; + Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; } } } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismViewTest.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismViewTest.cs (.../HeightStructuresFailureMechanismViewTest.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismViewTest.cs (.../HeightStructuresFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -89,9 +89,7 @@ // Setup using (var view = new HeightStructuresFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new HeightStructuresFailureMechanismContext( new HeightStructuresFailureMechanism(), assessmentSection); @@ -101,8 +99,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); - - mockRepository.VerifyAll(); } } @@ -130,7 +126,10 @@ IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub { - BackgroundMapData = backgroundMapData + BackgroundMapData = + { + MapData = backgroundMapData + } }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) @@ -153,9 +152,7 @@ // Setup using (var view = new HeightStructuresFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new HeightStructuresFailureMechanismContext( new HeightStructuresFailureMechanism(), assessmentSection); @@ -172,8 +169,6 @@ Assert.IsNull(view.Data); Assert.IsNull(view.Map.Data); Assert.IsNull(view.Map.BackgroundMapData); - - mockRepository.VerifyAll(); } } @@ -183,9 +178,7 @@ // Setup using (var view = new HeightStructuresFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new HeightStructuresFailureMechanismContext( new HeightStructuresFailureMechanism(), assessmentSection); @@ -196,8 +189,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); AssertEmptyMapData(view.Map.Data); - - mockRepository.VerifyAll(); } } @@ -232,11 +223,11 @@ new Point2D(2.0, 1.0) }); - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - assessmentSection.ReferenceLine = referenceLine; - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub + { + HydraulicBoundaryDatabase = hydraulicBoundaryDatabase, + ReferenceLine = referenceLine + }; var calculationLocationA = new Point2D(1.2, 2.3); var calculationLocationB = new Point2D(2.7, 2.0); @@ -303,8 +294,6 @@ AssertCalculationsMapData( failureMechanism.Calculations.Cast>(), mapDataList[calculationsIndex]); - - mockRepository.VerifyAll(); } } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/ViewInfos/HeightStructuresFailureMechanismViewInfoTest.cs =================================================================== diff -u -r8e2eb144317c011c15783e8e850c9253d550450e -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/ViewInfos/HeightStructuresFailureMechanismViewInfoTest.cs (.../HeightStructuresFailureMechanismViewInfoTest.cs) (revision 8e2eb144317c011c15783e8e850c9253d550450e) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/ViewInfos/HeightStructuresFailureMechanismViewInfoTest.cs (.../HeightStructuresFailureMechanismViewInfoTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -25,6 +25,7 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Forms.PresentationObjects; using Ringtoets.HeightStructures.Forms.Views; @@ -87,7 +88,7 @@ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() { // Setup - var assessmentSection = mocks.Stub(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var otherAssessmentSection = mocks.Stub(); mocks.ReplayAll(); @@ -112,37 +113,34 @@ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanism = new HeightStructuresFailureMechanism(); - var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); using (var view = new HeightStructuresFailureMechanismView { Data = failureMechanismContext }) { // Call - bool closeForData = info.CloseForData(view, assessmentSectionStub); + bool closeForData = info.CloseForData(view, assessmentSection); // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanism = new HeightStructuresFailureMechanism(); var otherHeightStructuresFailureMechanism = new HeightStructuresFailureMechanism(); - var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); using (var view = new HeightStructuresFailureMechanismView { @@ -155,18 +153,16 @@ // Assert Assert.IsFalse(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanism = new HeightStructuresFailureMechanism(); - var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSection); using (var view = new HeightStructuresFailureMechanismView { @@ -179,7 +175,6 @@ // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs =================================================================== diff -u -rcad9ccc6257b370c0b642e88cab8c528b032c3d4 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision cad9ccc6257b370c0b642e88cab8c528b032c3d4) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -60,7 +60,13 @@ Name = Resources.AssessmentSection_DisplayName; Comments = new Comment(); - BackgroundMapData = WmtsMapData.CreateUnconnectedMapData(); + var mapData = WmtsMapData.CreateUnconnectedMapData(); + BackgroundMapData = new BackgroundMapDataContainer + { + IsVisible = mapData.IsVisible, + Transparency = mapData.Transparency, + MapData = mapData + }; PipingFailureMechanism = new PipingFailureMechanism(); GrassCoverErosionInwards = new GrassCoverErosionInwardsFailureMechanism(); @@ -205,7 +211,7 @@ public HydraulicBoundaryDatabase HydraulicBoundaryDatabase { get; set; } - public WmtsMapData BackgroundMapData { get; } + public BackgroundMapDataContainer BackgroundMapData { get; } public IEnumerable GetFailureMechanisms() { Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -92,7 +92,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = data.BackgroundMapData; + Map.BackgroundMapData = (WmtsMapData)data.BackgroundMapData.MapData; } } } Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -re955b2483ae95b097dd76135a3a95bb7ed05d496 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision e955b2483ae95b097dd76135a3a95bb7ed05d496) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -36,6 +36,7 @@ using Core.Common.Gui.Plugin; using Core.Common.IO.Exceptions; using Core.Common.Utils.Extensions; +using Core.Components.Gis.Data; using log4net; using Ringtoets.ClosingStructures.Data; using Ringtoets.ClosingStructures.Forms.PresentationObjects; @@ -1051,7 +1052,7 @@ { var childNodes = new List { - new BackgroundMapDataContext(nodeData.BackgroundMapData), + new BackgroundMapDataContext((WmtsMapData)nodeData.BackgroundMapData.MapData), new ReferenceLineContext(nodeData), new FailureMechanismContributionContext(nodeData.FailureMechanismContribution, nodeData), new HydraulicBoundaryDatabaseContext(nodeData), Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs =================================================================== diff -u -r000b675444761bd16bc9aa7860c2af198b705bb0 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision 000b675444761bd16bc9aa7860c2af198b705bb0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -23,6 +23,7 @@ using System.Linq; using Core.Common.Base; using Core.Common.Base.Geometry; +using Core.Components.Gis.Data; using NUnit.Framework; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Contribution; @@ -144,8 +145,9 @@ Assert.AreEqual(sum, section.FailureMechanismContribution.Distribution.Sum(d => d.Contribution)); Assert.IsFalse(section.BackgroundMapData.IsVisible); - Assert.IsFalse(section.BackgroundMapData.IsConfigured); Assert.AreEqual(0.0, section.BackgroundMapData.Transparency.Value); + var mapData = (WmtsMapData)section.BackgroundMapData.MapData; + Assert.IsFalse(mapData.IsConfigured); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs (.../AssessmentSectionViewTest.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs (.../AssessmentSectionViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -108,7 +108,10 @@ IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub { - BackgroundMapData = backgroundMapData + BackgroundMapData = + { + MapData = backgroundMapData + } }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs =================================================================== diff -u -rc990bf404015584981f3ec1d22ecec12a7b037f3 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision c990bf404015584981f3ec1d22ecec12a7b037f3) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -182,7 +182,7 @@ // Assert Assert.AreEqual(23, objects.Length); var backgroundMapData = (BackgroundMapDataContext) objects[0]; - Assert.AreSame(assessmentSection.BackgroundMapData, backgroundMapData.WrappedData); + Assert.AreSame(assessmentSection.BackgroundMapData.MapData, backgroundMapData.WrappedData); var referenceLineContext = (ReferenceLineContext) objects[1]; Assert.AreSame(assessmentSection, referenceLineContext.WrappedData); Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/StabilityPointStructuresFailureMechanismViewInfoTest.cs =================================================================== diff -u -rd30b839df8d71c1742a96ada6e422b44cdc9efff -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/StabilityPointStructuresFailureMechanismViewInfoTest.cs (.../StabilityPointStructuresFailureMechanismViewInfoTest.cs) (revision d30b839df8d71c1742a96ada6e422b44cdc9efff) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/StabilityPointStructuresFailureMechanismViewInfoTest.cs (.../StabilityPointStructuresFailureMechanismViewInfoTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -87,7 +87,7 @@ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() { // Setup - var assessmentSection = mocks.Stub(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var otherAssessmentSection = mocks.Stub(); mocks.ReplayAll(); @@ -112,37 +112,34 @@ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanism = new TestFailureMechanism(); - var failureMechanismContext = new FailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new FailureMechanismContext(failureMechanism, assessmentSection); using (var view = new FailureMechanismView { Data = failureMechanismContext }) { // Call - bool closeForData = info.CloseForData(view, assessmentSectionStub); + bool closeForData = info.CloseForData(view, assessmentSection); // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanism = new TestFailureMechanism(); var otherTestFailureMechanism = new TestFailureMechanism(); - var failureMechanismContext = new FailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new FailureMechanismContext(failureMechanism, assessmentSection); using (var view = new FailureMechanismView { @@ -155,18 +152,16 @@ // Assert Assert.IsFalse(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanism = new TestFailureMechanism(); - var failureMechanismContext = new FailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new FailureMechanismContext(failureMechanism, assessmentSection); using (var view = new FailureMechanismView { @@ -179,7 +174,6 @@ // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismView.cs =================================================================== diff -u -rd6d1b03ce8dc3c4e6bba565a85ea310f6196adea -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismView.cs (.../PipingFailureMechanismView.cs) (revision d6d1b03ce8dc3c4e6bba565a85ea310f6196adea) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismView.cs (.../PipingFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -147,7 +147,7 @@ SetMapDataFeatures(); - Map.BackgroundMapData = data.Parent.BackgroundMapData; + Map.BackgroundMapData = (WmtsMapData) data.Parent.BackgroundMapData.MapData; Map.Data = mapDataCollection; } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismViewTest.cs =================================================================== diff -u -r6c1eddbd3f88a9dcedec6c113de50416073ddfb3 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismViewTest.cs (.../PipingFailureMechanismViewTest.cs) (revision 6c1eddbd3f88a9dcedec6c113de50416073ddfb3) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismViewTest.cs (.../PipingFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -23,13 +23,15 @@ using System.Collections.ObjectModel; using System.Linq; using System.Windows.Forms; +using Core.Common.Base; using Core.Common.Base.Geometry; using Core.Components.DotSpatial.Forms; using Core.Components.DotSpatial.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; using Rhino.Mocks; +using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Hydraulics; @@ -89,9 +91,7 @@ // Setup using (var view = new PipingFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new PipingFailureMechanismContext( new PipingFailureMechanism(), assessmentSection); @@ -101,8 +101,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); - - mockRepository.VerifyAll(); } } @@ -128,9 +126,7 @@ // Setup using (var view = new PipingFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new PipingFailureMechanismContext( new PipingFailureMechanism(), assessmentSection); @@ -146,8 +142,6 @@ // Assert Assert.IsNull(view.Data); Assert.IsNull(view.Map.Data); - - mockRepository.VerifyAll(); } } @@ -159,7 +153,10 @@ var assessmentSection = new ObservableTestAssessmentSectionStub { - BackgroundMapData = backgroundMapData + BackgroundMapData = + { + MapData = backgroundMapData + } }; using (var view = new PipingFailureMechanismView()) @@ -185,7 +182,10 @@ var mocks = new MockRepository(); var assessmentSection = new ObservableTestAssessmentSectionStub { - BackgroundMapData = backgroundMapData + BackgroundMapData = + { + MapData = backgroundMapData + } }; // Setup @@ -210,7 +210,10 @@ WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); var assessmentSection = new ObservableTestAssessmentSectionStub { - BackgroundMapData = backgroundMapData + BackgroundMapData = + { + MapData = backgroundMapData + } }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) @@ -263,11 +266,11 @@ new Point2D(3.0, 0.0) }); - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - assessmentSection.ReferenceLine = referenceLine; - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub + { + HydraulicBoundaryDatabase = hydraulicBoundaryDatabase, + ReferenceLine = referenceLine + }; var stochasticSoilModel1 = new StochasticSoilModel(0, "name1", ""); stochasticSoilModel1.Geometry.AddRange(new[] @@ -342,8 +345,6 @@ MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(hydraulicBoundaryDatabase.Locations, mapDataList[hydraulicBoundaryLocationsIndex]); AssertStochasticSoilModelsMapData(failureMechanism.StochasticSoilModels, mapDataList[stochasticSoilModelsIndex]); AssertCalculationsMapData(failureMechanism.Calculations.Cast(), mapDataList[calculationsIndex]); - - mockRepository.VerifyAll(); } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismViewInfoTest.cs =================================================================== diff -u -r4eba092cb591f9f164f1e22f5b2bba25b148dda5 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismViewInfoTest.cs (.../PipingFailureMechanismViewInfoTest.cs) (revision 4eba092cb591f9f164f1e22f5b2bba25b148dda5) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismViewInfoTest.cs (.../PipingFailureMechanismViewInfoTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -25,6 +25,7 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Piping.Data; using Ringtoets.Piping.Forms.PresentationObjects; using Ringtoets.Piping.Forms.Views; @@ -88,7 +89,7 @@ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() { // Setup - var assessmentSection = mocks.Stub(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var otherAssessmentSection = mocks.Stub(); mocks.ReplayAll(); @@ -113,37 +114,34 @@ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var pipingFailureMechanism = new PipingFailureMechanism(); - var pipingFailureMechanismContext = new PipingFailureMechanismContext(pipingFailureMechanism, assessmentSectionStub); + var pipingFailureMechanismContext = new PipingFailureMechanismContext(pipingFailureMechanism, assessmentSection); using (var view = new PipingFailureMechanismView { Data = pipingFailureMechanismContext }) { // Call - bool closeForData = info.CloseForData(view, assessmentSectionStub); + bool closeForData = info.CloseForData(view, assessmentSection); // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var pipingFailureMechanism = new PipingFailureMechanism(); var otherPipingFailureMechanism = new PipingFailureMechanism(); - var pipingFailureMechanismContext = new PipingFailureMechanismContext(pipingFailureMechanism, assessmentSectionStub); + var pipingFailureMechanismContext = new PipingFailureMechanismContext(pipingFailureMechanism, assessmentSection); using (var view = new PipingFailureMechanismView { @@ -156,18 +154,16 @@ // Assert Assert.IsFalse(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var pipingFailureMechanism = new PipingFailureMechanism(); - var pipingFailureMechanismContext = new PipingFailureMechanismContext(pipingFailureMechanism, assessmentSectionStub); + var pipingFailureMechanismContext = new PipingFailureMechanismContext(pipingFailureMechanism, assessmentSection); using (var view = new PipingFailureMechanismView { @@ -180,7 +176,6 @@ // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.cs (.../StabilityPointStructuresFailureMechanismView.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.cs (.../StabilityPointStructuresFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -149,7 +149,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = data.Parent.BackgroundMapData; + Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; } } } Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismViewTest.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismViewTest.cs (.../StabilityPointStructuresFailureMechanismViewTest.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismViewTest.cs (.../StabilityPointStructuresFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -28,7 +28,6 @@ using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; -using Rhino.Mocks; using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; @@ -89,9 +88,7 @@ // Setup using (var view = new StabilityPointStructuresFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext( new StabilityPointStructuresFailureMechanism(), assessmentSection); @@ -101,8 +98,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); - - mockRepository.VerifyAll(); } } @@ -130,7 +125,10 @@ IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub { - BackgroundMapData = backgroundMapData + BackgroundMapData = + { + MapData = backgroundMapData + } }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) @@ -153,9 +151,7 @@ // Setup using (var view = new StabilityPointStructuresFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext( new StabilityPointStructuresFailureMechanism(), assessmentSection); @@ -172,8 +168,6 @@ Assert.IsNull(view.Data); Assert.IsNull(view.Map.Data); Assert.IsNull(view.Map.BackgroundMapData); - - mockRepository.VerifyAll(); } } @@ -183,9 +177,7 @@ // Setup using (var view = new StabilityPointStructuresFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext( new StabilityPointStructuresFailureMechanism(), assessmentSection); @@ -196,8 +188,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); AssertEmptyMapData(view.Map.Data); - - mockRepository.VerifyAll(); } } @@ -227,16 +217,16 @@ var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] - { - new Point2D(1.0, 2.0), - new Point2D(2.0, 1.0) - }); + { + new Point2D(1.0, 2.0), + new Point2D(2.0, 1.0) + }); - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - assessmentSection.ReferenceLine = referenceLine; - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub + { + HydraulicBoundaryDatabase = hydraulicBoundaryDatabase, + ReferenceLine = referenceLine + }; var calculationLocationA = new Point2D(1.2, 2.3); var calculationLocationB = new Point2D(2.7, 2.0); @@ -268,15 +258,15 @@ failureMechanism.AddSection(new FailureMechanismSection("C", geometryPoints.Skip(2).Take(2))); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); + { + new Point2D(0, 0), + new Point2D(1, 1) + })); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(2, 2), - new Point2D(3, 3) - })); + { + new Point2D(2, 2), + new Point2D(3, 3) + })); failureMechanism.CalculationsGroup.Children.Add(calculationA); failureMechanism.CalculationsGroup.Children.Add(calculationB); @@ -303,8 +293,6 @@ AssertCalculationsMapData( failureMechanism.Calculations.Cast>(), mapDataList[calculationsIndex]); - - mockRepository.VerifyAll(); } } @@ -502,10 +490,10 @@ // Call failureMechanism.AddSection(new FailureMechanismSection(string.Empty, new[] - { - new Point2D(1, 2), - new Point2D(1, 2) - })); + { + new Point2D(1, 2), + new Point2D(1, 2) + })); failureMechanism.NotifyObservers(); // Assert @@ -527,10 +515,10 @@ var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(failureMechanism, new ObservableTestAssessmentSectionStub()); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); + { + new Point2D(0, 0), + new Point2D(1, 1) + })); view.Data = failureMechanismContext; @@ -541,10 +529,10 @@ // Call failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(2, 2), - new Point2D(3, 3) - })); + { + new Point2D(2, 2), + new Point2D(3, 3) + })); failureMechanism.ForeshoreProfiles.NotifyObservers(); // Assert @@ -813,10 +801,10 @@ newAssessmentSection.ReferenceLine = new ReferenceLine(); newAssessmentSection.ReferenceLine.SetGeometry(new[] - { - new Point2D(2, 4), - new Point2D(3, 4) - }); + { + new Point2D(2, 4), + new Point2D(3, 4) + }); var oldStabilityPointStructuresFailureMechanismContext = new StabilityPointStructuresFailureMechanismContext(new StabilityPointStructuresFailureMechanism(), oldAssessmentSection); var newStabilityPointStructuresFailureMechanismContext = new StabilityPointStructuresFailureMechanismContext(new StabilityPointStructuresFailureMechanism(), newAssessmentSection); @@ -871,10 +859,10 @@ StructuresCalculation calculation = calculationsArray[index]; CollectionAssert.AreEquivalent(new[] - { - calculation.InputParameters.Structure.Location, - calculation.InputParameters.HydraulicBoundaryLocation.Location - }, geometries[0].PointCollections.First()); + { + calculation.InputParameters.Structure.Location, + calculation.InputParameters.HydraulicBoundaryLocation.Location + }, geometries[0].PointCollections.First()); } Assert.AreEqual("Berekeningen", mapData.Name); } Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj =================================================================== diff -u -r6a5d7b40b7ba4dcb73e393075338352d194e97c2 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj (.../Ringtoets.StabilityPointStructures.Plugin.Test.csproj) (revision 6a5d7b40b7ba4dcb73e393075338352d194e97c2) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj (.../Ringtoets.StabilityPointStructures.Plugin.Test.csproj) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -128,6 +128,10 @@ {52ba7627-cbab-4209-be77-3b5f31378277} Ringtoets.Common.IO + + {4843d6e5-066f-4795-94f5-1d53932dd03c} + Ringtoets.Common.Data.TestUtil + {74CBA865-9338-447F-BAD9-28312446AE84} Ringtoets.HydraRing.Calculation.TestUtil Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/ViewInfos/StabilityPointStructuresFailureMechanismViewInfoTest.cs =================================================================== diff -u -r4eba092cb591f9f164f1e22f5b2bba25b148dda5 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/ViewInfos/StabilityPointStructuresFailureMechanismViewInfoTest.cs (.../StabilityPointStructuresFailureMechanismViewInfoTest.cs) (revision 4eba092cb591f9f164f1e22f5b2bba25b148dda5) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/ViewInfos/StabilityPointStructuresFailureMechanismViewInfoTest.cs (.../StabilityPointStructuresFailureMechanismViewInfoTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -25,6 +25,7 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.StabilityPointStructures.Data; using Ringtoets.StabilityPointStructures.Forms.PresentationObjects; using Ringtoets.StabilityPointStructures.Forms.Views; @@ -87,7 +88,7 @@ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() { // Setup - var assessmentSection = mocks.Stub(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var otherAssessmentSection = mocks.Stub(); mocks.ReplayAll(); @@ -112,37 +113,34 @@ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanism = new StabilityPointStructuresFailureMechanism(); - var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSection); using (var view = new StabilityPointStructuresFailureMechanismView { Data = failureMechanismContext }) { // Call - bool closeForData = info.CloseForData(view, assessmentSectionStub); + bool closeForData = info.CloseForData(view, assessmentSection); // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanism = new StabilityPointStructuresFailureMechanism(); var otherStabilityPointStructuresFailureMechanism = new StabilityPointStructuresFailureMechanism(); - var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSection); using (var view = new StabilityPointStructuresFailureMechanismView { @@ -155,18 +153,16 @@ // Assert Assert.IsFalse(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanism = new StabilityPointStructuresFailureMechanism(); - var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSectionStub); + var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSection); using (var view = new StabilityPointStructuresFailureMechanismView { @@ -179,7 +175,6 @@ // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverFailureMechanismView.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverFailureMechanismView.cs (.../StabilityStoneCoverFailureMechanismView.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverFailureMechanismView.cs (.../StabilityStoneCoverFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -142,7 +142,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = data.Parent.BackgroundMapData; + Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; } } } Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverFailureMechanismViewTest.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverFailureMechanismViewTest.cs (.../StabilityStoneCoverFailureMechanismViewTest.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverFailureMechanismViewTest.cs (.../StabilityStoneCoverFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -28,7 +28,6 @@ using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; -using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Hydraulics; @@ -85,9 +84,7 @@ // Setup using (var view = new StabilityStoneCoverFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new StabilityStoneCoverFailureMechanismContext( new StabilityStoneCoverFailureMechanism(), assessmentSection); @@ -97,8 +94,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); - - mockRepository.VerifyAll(); } } @@ -126,7 +121,10 @@ IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub { - BackgroundMapData = backgroundMapData + BackgroundMapData = + { + MapData = backgroundMapData + } }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) @@ -149,9 +147,7 @@ // Setup using (var view = new StabilityStoneCoverFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new StabilityStoneCoverFailureMechanismContext( new StabilityStoneCoverFailureMechanism(), assessmentSection); @@ -168,8 +164,6 @@ Assert.IsNull(view.Data); Assert.IsNull(view.Map.Data); Assert.IsNull(view.Map.BackgroundMapData); - - mockRepository.VerifyAll(); } } @@ -179,9 +173,7 @@ // Setup using (var view = new StabilityStoneCoverFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new StabilityStoneCoverFailureMechanismContext( new StabilityStoneCoverFailureMechanism(), assessmentSection); @@ -192,8 +184,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); AssertEmptyMapData(view.Map.Data); - - mockRepository.VerifyAll(); } } @@ -223,16 +213,16 @@ var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] - { - new Point2D(1.0, 2.0), - new Point2D(2.0, 1.0) - }); + { + new Point2D(1.0, 2.0), + new Point2D(2.0, 1.0) + }); - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - assessmentSection.ReferenceLine = referenceLine; - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub + { + HydraulicBoundaryDatabase = hydraulicBoundaryDatabase, + ReferenceLine = referenceLine + }; var foreshoreProfileA = new TestForeshoreProfile(new Point2D(1.3, 1.3)); var foreshoreProfileB = new TestForeshoreProfile(new Point2D(1.5, 1.5)); @@ -260,15 +250,15 @@ failureMechanism.AddSection(new FailureMechanismSection("C", geometryPoints.Skip(2).Take(2))); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); + { + new Point2D(0, 0), + new Point2D(1, 1) + })); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(2, 2), - new Point2D(3, 3) - })); + { + new Point2D(2, 2), + new Point2D(3, 3) + })); failureMechanism.WaveConditionsCalculationGroup.Children.Add(calculationA); failureMechanism.WaveConditionsCalculationGroup.Children.Add(calculationB); @@ -292,8 +282,6 @@ MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(hydraulicBoundaryDatabase.Locations, mapDataList[hydraulicBoundaryLocationsIndex]); MapDataTestHelper.AssertForeshoreProfilesMapData(failureMechanism.ForeshoreProfiles, mapDataList[foreshoreProfilesIndex]); AssertCalculationsMapData(failureMechanism.Calculations.Cast(), mapDataList[calculationsIndex]); - - mockRepository.VerifyAll(); } } @@ -445,10 +433,10 @@ // Call failureMechanism.AddSection(new FailureMechanismSection(string.Empty, new[] - { - new Point2D(1, 2), - new Point2D(1, 2) - })); + { + new Point2D(1, 2), + new Point2D(1, 2) + })); failureMechanism.NotifyObservers(); // Assert @@ -470,10 +458,10 @@ var failureMechanismContext = new StabilityStoneCoverFailureMechanismContext(failureMechanism, new ObservableTestAssessmentSectionStub()); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); + { + new Point2D(0, 0), + new Point2D(1, 1) + })); view.Data = failureMechanismContext; @@ -484,10 +472,10 @@ // Call failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(2, 2), - new Point2D(3, 3) - })); + { + new Point2D(2, 2), + new Point2D(3, 3) + })); failureMechanism.ForeshoreProfiles.NotifyObservers(); // Assert @@ -710,10 +698,10 @@ newAssessmentSection.ReferenceLine = new ReferenceLine(); newAssessmentSection.ReferenceLine.SetGeometry(new[] - { - new Point2D(2, 4), - new Point2D(3, 4) - }); + { + new Point2D(2, 4), + new Point2D(3, 4) + }); var oldStabilityStoneCoverFailureMechanismContext = new StabilityStoneCoverFailureMechanismContext(new StabilityStoneCoverFailureMechanism(), oldAssessmentSection); var newStabilityStoneCoverFailureMechanismContext = new StabilityStoneCoverFailureMechanismContext(new StabilityStoneCoverFailureMechanism(), newAssessmentSection); @@ -750,10 +738,10 @@ StabilityStoneCoverWaveConditionsCalculation calculation = calculationsArray[index]; CollectionAssert.AreEquivalent(new[] - { - calculation.InputParameters.ForeshoreProfile.WorldReferencePoint, - calculation.InputParameters.HydraulicBoundaryLocation.Location - }, geometries[0].PointCollections.First()); + { + calculation.InputParameters.ForeshoreProfile.WorldReferencePoint, + calculation.InputParameters.HydraulicBoundaryLocation.Location + }, geometries[0].PointCollections.First()); } Assert.AreEqual("Berekeningen", mapData.Name); } Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ViewInfos/StabilityStoneCoverFailureMechanismViewInfoTest.cs =================================================================== diff -u -r4eba092cb591f9f164f1e22f5b2bba25b148dda5 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ViewInfos/StabilityStoneCoverFailureMechanismViewInfoTest.cs (.../StabilityStoneCoverFailureMechanismViewInfoTest.cs) (revision 4eba092cb591f9f164f1e22f5b2bba25b148dda5) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ViewInfos/StabilityStoneCoverFailureMechanismViewInfoTest.cs (.../StabilityStoneCoverFailureMechanismViewInfoTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -25,6 +25,7 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.StabilityStoneCover.Data; using Ringtoets.StabilityStoneCover.Forms.PresentationObjects; using Ringtoets.StabilityStoneCover.Forms.Views; @@ -88,7 +89,7 @@ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() { // Setup - var assessmentSection = mocks.Stub(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var otherAssessmentSection = mocks.Stub(); mocks.ReplayAll(); @@ -113,37 +114,34 @@ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var stabilityStoneCoverFailureMechanism = new StabilityStoneCoverFailureMechanism(); - var stabilityStoneCoverFailureMechanismContext = new StabilityStoneCoverFailureMechanismContext(stabilityStoneCoverFailureMechanism, assessmentSectionStub); + var stabilityStoneCoverFailureMechanismContext = new StabilityStoneCoverFailureMechanismContext(stabilityStoneCoverFailureMechanism, assessmentSection); using (var view = new StabilityStoneCoverFailureMechanismView { Data = stabilityStoneCoverFailureMechanismContext }) { // Call - bool closeForData = info.CloseForData(view, assessmentSectionStub); + bool closeForData = info.CloseForData(view, assessmentSection); // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var stabilityStoneCoverFailureMechanism = new StabilityStoneCoverFailureMechanism(); var otherStabilityStoneCoverFailureMechanism = new StabilityStoneCoverFailureMechanism(); - var stabilityStoneCoverFailureMechanismContext = new StabilityStoneCoverFailureMechanismContext(stabilityStoneCoverFailureMechanism, assessmentSectionStub); + var stabilityStoneCoverFailureMechanismContext = new StabilityStoneCoverFailureMechanismContext(stabilityStoneCoverFailureMechanism, assessmentSection); using (var view = new StabilityStoneCoverFailureMechanismView { @@ -156,18 +154,16 @@ // Assert Assert.IsFalse(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var stabilityStoneCoverFailureMechanism = new StabilityStoneCoverFailureMechanism(); - var stabilityStoneCoverFailureMechanismContext = new StabilityStoneCoverFailureMechanismContext(stabilityStoneCoverFailureMechanism, assessmentSectionStub); + var stabilityStoneCoverFailureMechanismContext = new StabilityStoneCoverFailureMechanismContext(stabilityStoneCoverFailureMechanism, assessmentSection); using (var view = new StabilityStoneCoverFailureMechanismView { @@ -180,7 +176,6 @@ // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test] Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismView.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismView.cs (.../WaveImpactAsphaltCoverFailureMechanismView.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismView.cs (.../WaveImpactAsphaltCoverFailureMechanismView.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -142,7 +142,7 @@ SetMapDataFeatures(); Map.Data = mapDataCollection; - Map.BackgroundMapData = data.Parent.BackgroundMapData; + Map.BackgroundMapData = (WmtsMapData)data.Parent.BackgroundMapData.MapData; } } } Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismViewTest.cs =================================================================== diff -u -r737cd3675ab5bc1b6400e4a0b86ebd543eaee650 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismViewTest.cs (.../WaveImpactAsphaltCoverFailureMechanismViewTest.cs) (revision 737cd3675ab5bc1b6400e4a0b86ebd543eaee650) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismViewTest.cs (.../WaveImpactAsphaltCoverFailureMechanismViewTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -28,7 +28,6 @@ using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using NUnit.Framework; -using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Hydraulics; @@ -85,9 +84,7 @@ // Setup using (var view = new WaveImpactAsphaltCoverFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new WaveImpactAsphaltCoverFailureMechanismContext( new WaveImpactAsphaltCoverFailureMechanism(), assessmentSection); @@ -97,8 +94,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); - - mockRepository.VerifyAll(); } } @@ -126,7 +121,10 @@ IAssessmentSection assessmentSection = new ObservableTestAssessmentSectionStub { - BackgroundMapData = backgroundMapData + BackgroundMapData = + { + MapData = backgroundMapData + } }; using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) @@ -149,9 +147,7 @@ // Setup using (var view = new WaveImpactAsphaltCoverFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new WaveImpactAsphaltCoverFailureMechanismContext( new WaveImpactAsphaltCoverFailureMechanism(), assessmentSection); @@ -168,8 +164,6 @@ Assert.IsNull(view.Data); Assert.IsNull(view.Map.Data); Assert.IsNull(view.Map.BackgroundMapData); - - mockRepository.VerifyAll(); } } @@ -179,9 +173,7 @@ // Setup using (var view = new WaveImpactAsphaltCoverFailureMechanismView()) { - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var failureMechanismContext = new WaveImpactAsphaltCoverFailureMechanismContext( new WaveImpactAsphaltCoverFailureMechanism(), assessmentSection); @@ -192,8 +184,6 @@ // Assert Assert.AreSame(failureMechanismContext, view.Data); AssertEmptyMapData(view.Map.Data); - - mockRepository.VerifyAll(); } } @@ -223,16 +213,16 @@ var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] - { - new Point2D(1.0, 2.0), - new Point2D(2.0, 1.0) - }); + { + new Point2D(1.0, 2.0), + new Point2D(2.0, 1.0) + }); - var mockRepository = new MockRepository(); - var assessmentSection = mockRepository.Stub(); - assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - assessmentSection.ReferenceLine = referenceLine; - mockRepository.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub + { + HydraulicBoundaryDatabase = hydraulicBoundaryDatabase, + ReferenceLine = referenceLine + }; var foreshoreProfileA = new TestForeshoreProfile(new Point2D(1.3, 1.3)); var foreshoreProfileB = new TestForeshoreProfile(new Point2D(1.5, 1.5)); @@ -260,15 +250,15 @@ failureMechanism.AddSection(new FailureMechanismSection("C", geometryPoints.Skip(2).Take(2))); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); + { + new Point2D(0, 0), + new Point2D(1, 1) + })); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(2, 2), - new Point2D(3, 3) - })); + { + new Point2D(2, 2), + new Point2D(3, 3) + })); failureMechanism.WaveConditionsCalculationGroup.Children.Add(calculationA); failureMechanism.WaveConditionsCalculationGroup.Children.Add(calculationB); @@ -293,8 +283,6 @@ MapDataTestHelper.AssertForeshoreProfilesMapData(failureMechanism.ForeshoreProfiles, mapDataList[foreshoreProfilesIndex]); AssertCalculationsMapData(failureMechanism.Calculations.Cast(), mapDataList[calculationsIndex]); - - mockRepository.VerifyAll(); } } @@ -446,10 +434,10 @@ // Call failureMechanism.AddSection(new FailureMechanismSection(string.Empty, new[] - { - new Point2D(1, 2), - new Point2D(1, 2) - })); + { + new Point2D(1, 2), + new Point2D(1, 2) + })); failureMechanism.NotifyObservers(); // Assert @@ -471,10 +459,10 @@ var failureMechanismContext = new WaveImpactAsphaltCoverFailureMechanismContext(failureMechanism, new ObservableTestAssessmentSectionStub()); failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); + { + new Point2D(0, 0), + new Point2D(1, 1) + })); view.Data = failureMechanismContext; @@ -485,10 +473,10 @@ // Call failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile(new[] - { - new Point2D(2, 2), - new Point2D(3, 3) - })); + { + new Point2D(2, 2), + new Point2D(3, 3) + })); failureMechanism.ForeshoreProfiles.NotifyObservers(); // Assert @@ -711,10 +699,10 @@ newAssessmentSection.ReferenceLine = new ReferenceLine(); newAssessmentSection.ReferenceLine.SetGeometry(new[] - { - new Point2D(2, 4), - new Point2D(3, 4) - }); + { + new Point2D(2, 4), + new Point2D(3, 4) + }); var oldWaveImpactAsphaltCoverFailureMechanismContext = new WaveImpactAsphaltCoverFailureMechanismContext(new WaveImpactAsphaltCoverFailureMechanism(), oldAssessmentSection); var newWaveImpactAsphaltCoverFailureMechanismContext = new WaveImpactAsphaltCoverFailureMechanismContext(new WaveImpactAsphaltCoverFailureMechanism(), newAssessmentSection); @@ -751,10 +739,10 @@ WaveImpactAsphaltCoverWaveConditionsCalculation calculation = calculationsArray[index]; CollectionAssert.AreEquivalent(new[] - { - calculation.InputParameters.ForeshoreProfile.WorldReferencePoint, - calculation.InputParameters.HydraulicBoundaryLocation.Location - }, geometries[0].PointCollections.First()); + { + calculation.InputParameters.ForeshoreProfile.WorldReferencePoint, + calculation.InputParameters.HydraulicBoundaryLocation.Location + }, geometries[0].PointCollections.First()); } Assert.AreEqual("Berekeningen", mapData.Name); } Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ViewInfos/WaveImpactAsphaltCoverFailureMechanismViewInfoTest.cs =================================================================== diff -u -r4eba092cb591f9f164f1e22f5b2bba25b148dda5 -r3014d0ced22c45300938639e7958ea0850485240 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ViewInfos/WaveImpactAsphaltCoverFailureMechanismViewInfoTest.cs (.../WaveImpactAsphaltCoverFailureMechanismViewInfoTest.cs) (revision 4eba092cb591f9f164f1e22f5b2bba25b148dda5) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ViewInfos/WaveImpactAsphaltCoverFailureMechanismViewInfoTest.cs (.../WaveImpactAsphaltCoverFailureMechanismViewInfoTest.cs) (revision 3014d0ced22c45300938639e7958ea0850485240) @@ -25,6 +25,7 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.WaveImpactAsphaltCover.Data; using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects; using Ringtoets.WaveImpactAsphaltCover.Forms.Views; @@ -88,7 +89,7 @@ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() { // Setup - var assessmentSection = mocks.Stub(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var otherAssessmentSection = mocks.Stub(); mocks.ReplayAll(); @@ -113,19 +114,18 @@ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var waveImpactAsphaltCoverFailureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - var waveImpactAsphaltCoverFailureMechanismContext = new WaveImpactAsphaltCoverFailureMechanismContext(waveImpactAsphaltCoverFailureMechanism, assessmentSectionStub); + var waveImpactAsphaltCoverFailureMechanismContext = new WaveImpactAsphaltCoverFailureMechanismContext(waveImpactAsphaltCoverFailureMechanism, assessmentSection); using (var view = new WaveImpactAsphaltCoverFailureMechanismView { Data = waveImpactAsphaltCoverFailureMechanismContext }) { // Call - bool closeForData = info.CloseForData(view, assessmentSectionStub); + bool closeForData = info.CloseForData(view, assessmentSection); // Assert Assert.IsTrue(closeForData); @@ -137,13 +137,12 @@ public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var waveImpactAsphaltCoverFailureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); var otherWaveImpactAsphaltCoverFailureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - var waveImpactAsphaltCoverFailureMechanismContext = new WaveImpactAsphaltCoverFailureMechanismContext(waveImpactAsphaltCoverFailureMechanism, assessmentSectionStub); + var waveImpactAsphaltCoverFailureMechanismContext = new WaveImpactAsphaltCoverFailureMechanismContext(waveImpactAsphaltCoverFailureMechanism, assessmentSection); using (var view = new WaveImpactAsphaltCoverFailureMechanismView { @@ -156,18 +155,16 @@ // Assert Assert.IsFalse(closeForData); } - mocks.VerifyAll(); } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup - var assessmentSectionStub = mocks.Stub(); - mocks.ReplayAll(); + var assessmentSection = new ObservableTestAssessmentSectionStub(); var waveImpactAsphaltCoverFailureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - var waveImpactAsphaltCoverFailureMechanismContext = new WaveImpactAsphaltCoverFailureMechanismContext(waveImpactAsphaltCoverFailureMechanism, assessmentSectionStub); + var waveImpactAsphaltCoverFailureMechanismContext = new WaveImpactAsphaltCoverFailureMechanismContext(waveImpactAsphaltCoverFailureMechanism, assessmentSection); using (var view = new WaveImpactAsphaltCoverFailureMechanismView { @@ -180,7 +177,6 @@ // Assert Assert.IsTrue(closeForData); } - mocks.VerifyAll(); } [Test]