Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundDataTreeNodeInfoTest.cs =================================================================== diff -u -rd2d96421974b56eb204dd8f756748aa582da0874 -r9c23520df7a2adf82996d79bf59b83fc1adc1f26 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundDataTreeNodeInfoTest.cs (.../BackgroundDataTreeNodeInfoTest.cs) (revision d2d96421974b56eb204dd8f756748aa582da0874) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundDataTreeNodeInfoTest.cs (.../BackgroundDataTreeNodeInfoTest.cs) (revision 9c23520df7a2adf82996d79bf59b83fc1adc1f26) @@ -404,14 +404,7 @@ assessmentSection.Attach(assessmentSectionObserver); assessmentSection.BackgroundData.Attach(backgroundMapDataObserver); - assessmentSection.BackgroundData.Name = mapData.Name; - assessmentSection.BackgroundData.IsVisible = mapData.IsVisible; - assessmentSection.BackgroundData.IsConfigured = mapData.IsConfigured; - assessmentSection.BackgroundData.Transparency = mapData.Transparency; - assessmentSection.BackgroundData.BackgroundMapDataType = BackgroundMapDataType.Wmts; - assessmentSection.BackgroundData.Parameters[BackgroundDataIdentifiers.SourceCapabilitiesUrl] = mapData.SourceCapabilitiesUrl; - assessmentSection.BackgroundData.Parameters[BackgroundDataIdentifiers.SelectedCapabilityIdentifier] = mapData.SelectedCapabilityIdentifier; - assessmentSection.BackgroundData.Parameters[BackgroundDataIdentifiers.PreferredFormat] = mapData.PreferredFormat; + SetBackgroundData(assessmentSection, mapData); DialogBoxHandler = (name, wnd) => { @@ -475,14 +468,7 @@ assessmentSection.Attach(assessmentSectionObserver); assessmentSection.BackgroundData.Attach(backgroundMapDataObserver); - assessmentSection.BackgroundData.Name = mapData.Name; - assessmentSection.BackgroundData.IsVisible = mapData.IsVisible; - assessmentSection.BackgroundData.IsConfigured = mapData.IsConfigured; - assessmentSection.BackgroundData.Transparency = mapData.Transparency; - assessmentSection.BackgroundData.BackgroundMapDataType = BackgroundMapDataType.Wmts; - assessmentSection.BackgroundData.Parameters[BackgroundDataIdentifiers.SourceCapabilitiesUrl] = mapData.SourceCapabilitiesUrl; - assessmentSection.BackgroundData.Parameters[BackgroundDataIdentifiers.SelectedCapabilityIdentifier] = mapData.SelectedCapabilityIdentifier; - assessmentSection.BackgroundData.Parameters[BackgroundDataIdentifiers.PreferredFormat] = mapData.PreferredFormat; + SetBackgroundData(assessmentSection, mapData); DialogBoxHandler = (name, wnd) => { @@ -550,11 +536,7 @@ assessmentSection.Attach(assessmentSectionObserver); assessmentSection.BackgroundData.Attach(backgroundMapDataObserver); - assessmentSection.BackgroundData.Name = backgroundData.Name; - assessmentSection.BackgroundData.IsVisible = backgroundData.IsVisible; - assessmentSection.BackgroundData.IsConfigured = backgroundData.IsConfigured; - assessmentSection.BackgroundData.Transparency = backgroundData.Transparency; - assessmentSection.BackgroundData.BackgroundMapDataType = backgroundData.BackgroundMapDataType; + SetBackgroundData(assessmentSection, mapData); DialogBoxHandler = (name, wnd) => { @@ -578,6 +560,22 @@ mockRepository.VerifyAll(); } + private static void SetBackgroundData(IAssessmentSection assessmentSection, WmtsMapData mapData) + { + assessmentSection.BackgroundData.Name = mapData.Name; + assessmentSection.BackgroundData.IsVisible = mapData.IsVisible; + assessmentSection.BackgroundData.IsConfigured = mapData.IsConfigured; + assessmentSection.BackgroundData.Transparency = mapData.Transparency; + assessmentSection.BackgroundData.BackgroundMapDataType = BackgroundMapDataType.Wmts; + + if (mapData.IsConfigured) + { + assessmentSection.BackgroundData.Parameters[BackgroundDataIdentifiers.SourceCapabilitiesUrl] = mapData.SourceCapabilitiesUrl; + assessmentSection.BackgroundData.Parameters[BackgroundDataIdentifiers.SelectedCapabilityIdentifier] = mapData.SelectedCapabilityIdentifier; + assessmentSection.BackgroundData.Parameters[BackgroundDataIdentifiers.PreferredFormat] = mapData.PreferredFormat; + } + } + private static void AssertBackgroundMapDataProperties(WmtsMapData mapData, BackgroundData backgroundData) { Assert.AreEqual(mapData.Name, backgroundData.Name);