Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/BackgroundMapDataSelectionDialogTest.cs =================================================================== diff -u -rd506ab6eea64d53852f6419f39493e3a326078b0 -rf35a1bdec32700c5cb0027d714c8a51dfc118e0d --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/BackgroundMapDataSelectionDialogTest.cs (.../BackgroundMapDataSelectionDialogTest.cs) (revision d506ab6eea64d53852f6419f39493e3a326078b0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/BackgroundMapDataSelectionDialogTest.cs (.../BackgroundMapDataSelectionDialogTest.cs) (revision f35a1bdec32700c5cb0027d714c8a51dfc118e0d) @@ -27,8 +27,10 @@ using Core.Common.Controls.Dialogs; using Core.Common.TestUtil; using Core.Components.DotSpatial.Forms.Views; +using Core.Components.Gis.Data; using NUnit.Extensions.Forms; using NUnit.Framework; +using Rhino.Mocks; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.Integration.Forms.Test @@ -66,7 +68,7 @@ Bitmap actualImage = dialog.Icon.ToBitmap(); TestHelper.AssertImagesAreEqual(expectedImage, actualImage); - var mapLayers = (ComboBox)new ComboBoxTester("mapLayerComboBox", dialog).TheObject; + var mapLayers = (ComboBox) new ComboBoxTester("mapLayerComboBox", dialog).TheObject; Assert.AreEqual(ComboBoxStyle.DropDownList, mapLayers.DropDownStyle); Assert.IsInstanceOf>(mapLayers.DataSource); Assert.AreEqual("DisplayName", mapLayers.DisplayMember); @@ -76,6 +78,66 @@ } [Test] + public void MapDataConstructor_MapDataNull_DefaultProperties() + { + // Setup + var mockRepository = new MockRepository(); + var dialogParent = mockRepository.Stub(); + mockRepository.ReplayAll(); + + // Call + using (var dialog = new BackgroundMapDataSelectionDialog(dialogParent, null)) + { + // Assert + Assert.IsNull(dialog.SelectedMapData); + } + mockRepository.VerifyAll(); + } + + [Test] + public void MapDataConstructor_ParentNull_ThrowsArgumentNullException() + { + // Setup + var mapData = new WmtsMapData("1", "2", "3", "image/"); + + // Call + TestDelegate test = () => new BackgroundMapDataSelectionDialog(null, mapData); + + // Assert + string parameter = Assert.Throws(test).ParamName; + Assert.AreEqual("dialogParent", parameter); + } + + [Test] + public void MapDataConstructor_WithParents_DefaultProperties() + { + // Setup + var mapData = new WmtsMapData("1", "2", "3", "image/"); + using (var dialogParent = new Form()) + { + // Call + using (var dialog = new BackgroundMapDataSelectionDialog(dialogParent, mapData)) + { + // Assert + Assert.IsInstanceOf(dialog); + Assert.AreEqual(@"Selecteer achtergrondkaart", dialog.Text); + Assert.AreSame(mapData, dialog.SelectedMapData); + + Icon icon = BitmapToIcon(RingtoetsCommonFormsResources.SelectionDialogIcon); + Bitmap expectedImage = icon.ToBitmap(); + Bitmap actualImage = dialog.Icon.ToBitmap(); + TestHelper.AssertImagesAreEqual(expectedImage, actualImage); + + var mapLayers = (ComboBox) new ComboBoxTester("mapLayerComboBox", dialog).TheObject; + Assert.AreEqual(ComboBoxStyle.DropDownList, mapLayers.DropDownStyle); + Assert.IsInstanceOf>(mapLayers.DataSource); + Assert.AreEqual("DisplayName", mapLayers.DisplayMember); + Assert.IsTrue(mapLayers.Sorted); + } + } + } + + [Test] [Apartment(ApartmentState.STA)] public void ShowDialog_Always_DefaultProperties() {