Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs =================================================================== diff -u -r7f540fc512a6c291d69612b1d0b9241d42288aef -r92be34a088da8406be8d0cb37aa19b2462acebe0 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 7f540fc512a6c291d69612b1d0b9241d42288aef) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 92be34a088da8406be8d0cb37aa19b2462acebe0) @@ -272,7 +272,7 @@ Assert.AreEqual(expectedAssessmentSection.Name, actualAssessmentSection.Name); AssertComments(expectedAssessmentSection.Comments, actualAssessmentSection.Comments); - AssertBackgroundData(expectedAssessmentSection.BackgroundData, actualAssessmentSection.BackgroundData); + BackgroundDataTestHelper.AssertBackgroundData(expectedAssessmentSection.BackgroundData, actualAssessmentSection.BackgroundData); AssertHydraulicBoundaryDatabase(expectedAssessmentSection.HydraulicBoundaryDatabase, actualAssessmentSection.HydraulicBoundaryDatabase); AssertReferenceLine(expectedAssessmentSection.ReferenceLine, actualAssessmentSection.ReferenceLine); AssertPipingFailureMechanism(expectedAssessmentSection.PipingFailureMechanism, actualAssessmentSection.PipingFailureMechanism); @@ -911,34 +911,6 @@ } } - #region BackgroundData - - private static void AssertBackgroundData(BackgroundData expectedBackgroundData, BackgroundData actualBackgroundData) - { - Assert.AreEqual(expectedBackgroundData.Name, actualBackgroundData.Name); - Assert.AreEqual(expectedBackgroundData.IsVisible, actualBackgroundData.IsVisible); - Assert.AreEqual(expectedBackgroundData.Transparency, actualBackgroundData.Transparency); - - var wmtsBackgroundDataConfiguration = expectedBackgroundData.Configuration as WmtsBackgroundDataConfiguration; - if (wmtsBackgroundDataConfiguration != null) - { - var actualWmtsBackgroundDataConfiguration = (WmtsBackgroundDataConfiguration)actualBackgroundData.Configuration; - Assert.AreEqual(wmtsBackgroundDataConfiguration.IsConfigured, actualWmtsBackgroundDataConfiguration.IsConfigured); - Assert.AreEqual(wmtsBackgroundDataConfiguration.SourceCapabilitiesUrl, actualWmtsBackgroundDataConfiguration.SourceCapabilitiesUrl); - Assert.AreEqual(wmtsBackgroundDataConfiguration.SelectedCapabilityIdentifier, actualWmtsBackgroundDataConfiguration.SelectedCapabilityIdentifier); - Assert.AreEqual(wmtsBackgroundDataConfiguration.PreferredFormat, actualWmtsBackgroundDataConfiguration.PreferredFormat); - } - - var wellKnownBackgroundDataConfiguration = expectedBackgroundData.Configuration as WellKnownBackgroundDataConfiguration; - if (wellKnownBackgroundDataConfiguration != null) - { - var actualWellKnownBackgroundDataConfiguration = (WellKnownBackgroundDataConfiguration)actualBackgroundData.Configuration; - Assert.AreEqual(wellKnownBackgroundDataConfiguration.WellKnownTileSource, actualWellKnownBackgroundDataConfiguration.WellKnownTileSource); - } - } - - #endregion - #region StabilityPointStructures FailureMechanism private static void AssertStabilityPointStructuresFailureMechanism(StabilityPointStructuresFailureMechanism expectedFailureMechanism, Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/BackgroundDataTestHelper.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/BackgroundDataTestHelper.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/BackgroundDataTestHelper.cs (revision 92be34a088da8406be8d0cb37aa19b2462acebe0) @@ -0,0 +1,76 @@ +// 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 NUnit.Framework; +using Ringtoets.Common.Data.AssessmentSection; + +namespace Ringtoets.Common.Data.TestUtil +{ + /// + /// Class that can be used to test properties of a . + /// + public static class BackgroundDataTestHelper + { + /// + /// Assert the background data. + /// + /// The background data with the expected properties. + /// The background data to assert. + /// Thrown when the properties of the + /// are not equal to the properties of . + public static void AssertBackgroundData(BackgroundData expectedBackgroundData, BackgroundData actualBackgroundData) + { + Assert.AreEqual(expectedBackgroundData.Name, actualBackgroundData.Name); + Assert.AreEqual(expectedBackgroundData.IsVisible, actualBackgroundData.IsVisible); + Assert.AreEqual(expectedBackgroundData.Transparency, actualBackgroundData.Transparency); + + IBackgroundDataConfiguration backgroundDataConfiguration = expectedBackgroundData.Configuration; + var wmtsBackgroundDataConfiguration = backgroundDataConfiguration as WmtsBackgroundDataConfiguration; + if (wmtsBackgroundDataConfiguration != null) + { + var actualWmtsBackgroundDataConfiguration = (WmtsBackgroundDataConfiguration)actualBackgroundData.Configuration; + AssertWmtsBackgroundConfiguration(wmtsBackgroundDataConfiguration, actualWmtsBackgroundDataConfiguration); + } + + var wellKnownBackgroundDataConfiguration = backgroundDataConfiguration as WellKnownBackgroundDataConfiguration; + if (wellKnownBackgroundDataConfiguration != null) + { + var actualWellKnownBackgroundDataConfiguration = (WellKnownBackgroundDataConfiguration)actualBackgroundData.Configuration; + AssertWellKnownBackgroundConfiguration(wellKnownBackgroundDataConfiguration, actualWellKnownBackgroundDataConfiguration); + } + } + + private static void AssertWellKnownBackgroundConfiguration(WellKnownBackgroundDataConfiguration wellKnownBackgroundDataConfiguration, + WellKnownBackgroundDataConfiguration actualWellKnownBackgroundDataConfiguration) + { + Assert.AreEqual(wellKnownBackgroundDataConfiguration.WellKnownTileSource, actualWellKnownBackgroundDataConfiguration.WellKnownTileSource); + } + + private static void AssertWmtsBackgroundConfiguration(WmtsBackgroundDataConfiguration expectedWmtsBackgroundDataConfiguration, + WmtsBackgroundDataConfiguration actualWmtsBackgroundDataConfiguration) + { + Assert.AreEqual(expectedWmtsBackgroundDataConfiguration.IsConfigured, actualWmtsBackgroundDataConfiguration.IsConfigured); + Assert.AreEqual(expectedWmtsBackgroundDataConfiguration.SourceCapabilitiesUrl, actualWmtsBackgroundDataConfiguration.SourceCapabilitiesUrl); + Assert.AreEqual(expectedWmtsBackgroundDataConfiguration.SelectedCapabilityIdentifier, actualWmtsBackgroundDataConfiguration.SelectedCapabilityIdentifier); + Assert.AreEqual(expectedWmtsBackgroundDataConfiguration.PreferredFormat, actualWmtsBackgroundDataConfiguration.PreferredFormat); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj =================================================================== diff -u -r7f540fc512a6c291d69612b1d0b9241d42288aef -r92be34a088da8406be8d0cb37aa19b2462acebe0 --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj (.../Ringtoets.Common.Data.TestUtil.csproj) (revision 7f540fc512a6c291d69612b1d0b9241d42288aef) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj (.../Ringtoets.Common.Data.TestUtil.csproj) (revision 92be34a088da8406be8d0cb37aa19b2462acebe0) @@ -55,6 +55,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundDataTreeNodeInfoTest.cs =================================================================== diff -u -r7f540fc512a6c291d69612b1d0b9241d42288aef -r92be34a088da8406be8d0cb37aa19b2462acebe0 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundDataTreeNodeInfoTest.cs (.../BackgroundDataTreeNodeInfoTest.cs) (revision 7f540fc512a6c291d69612b1d0b9241d42288aef) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundDataTreeNodeInfoTest.cs (.../BackgroundDataTreeNodeInfoTest.cs) (revision 92be34a088da8406be8d0cb37aa19b2462acebe0) @@ -390,7 +390,7 @@ contextMenuStrip.Items[selectContextMenuIndex].PerformClick(); // Then - AssertBackgroundData(oldBackgroundData, assessmentSection.BackgroundData); + BackgroundDataTestHelper.AssertBackgroundData(oldBackgroundData, assessmentSection.BackgroundData); } } mockRepository.VerifyAll(); @@ -585,7 +585,7 @@ contextMenuStrip.Items[selectContextMenuIndex].PerformClick(); // Then - AssertBackgroundData(backgroundData, assessmentSection.BackgroundData); + BackgroundDataTestHelper.AssertBackgroundData(backgroundData, assessmentSection.BackgroundData); } } mockRepository.VerifyAll(); @@ -627,43 +627,6 @@ Assert.AreEqual(mapData.TileSource, configuration.WellKnownTileSource); } - private static void AssertBackgroundData(BackgroundData expectedBackgroundData, BackgroundData actualBackgroundData) - { - Assert.AreEqual(expectedBackgroundData.Name, actualBackgroundData.Name); - Assert.AreEqual(expectedBackgroundData.IsVisible, actualBackgroundData.IsVisible); - Assert.AreEqual(expectedBackgroundData.Transparency, actualBackgroundData.Transparency); - - IBackgroundDataConfiguration backgroundDataConfiguration = expectedBackgroundData.Configuration; - var wmtsBackgroundDataConfiguration = backgroundDataConfiguration as WmtsBackgroundDataConfiguration; - if (wmtsBackgroundDataConfiguration != null) - { - var actualWmtsBackgroundDataConfiguration = (WmtsBackgroundDataConfiguration) actualBackgroundData.Configuration; - AssertWmtsBackgroundConfiguration(wmtsBackgroundDataConfiguration, actualWmtsBackgroundDataConfiguration); - } - - var wellKnownBackgroundDataConfiguration = backgroundDataConfiguration as WellKnownBackgroundDataConfiguration; - if (wellKnownBackgroundDataConfiguration != null) - { - var actualWellKnownBackgroundDataConfiguration = (WellKnownBackgroundDataConfiguration) actualBackgroundData.Configuration; - AssertWellKnownBackgroundConfiguration(wellKnownBackgroundDataConfiguration, actualWellKnownBackgroundDataConfiguration); - } - } - - private static void AssertWellKnownBackgroundConfiguration(WellKnownBackgroundDataConfiguration wellKnownBackgroundDataConfiguration, - WellKnownBackgroundDataConfiguration actualWellKnownBackgroundDataConfiguration) - { - Assert.AreEqual(wellKnownBackgroundDataConfiguration.WellKnownTileSource, actualWellKnownBackgroundDataConfiguration.WellKnownTileSource); - } - - private static void AssertWmtsBackgroundConfiguration(WmtsBackgroundDataConfiguration expectedWmtsBackgroundDataConfiguration, - WmtsBackgroundDataConfiguration actualWmtsBackgroundDataConfiguration) - { - Assert.AreEqual(expectedWmtsBackgroundDataConfiguration.IsConfigured, actualWmtsBackgroundDataConfiguration.IsConfigured); - Assert.AreEqual(expectedWmtsBackgroundDataConfiguration.SourceCapabilitiesUrl, actualWmtsBackgroundDataConfiguration.SourceCapabilitiesUrl); - Assert.AreEqual(expectedWmtsBackgroundDataConfiguration.SelectedCapabilityIdentifier, actualWmtsBackgroundDataConfiguration.SelectedCapabilityIdentifier); - Assert.AreEqual(expectedWmtsBackgroundDataConfiguration.PreferredFormat, actualWmtsBackgroundDataConfiguration.PreferredFormat); - } - private static TreeNodeInfo GetInfo(RingtoetsPlugin plugin) { return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(BackgroundData));