Index: Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs =================================================================== diff -u -ref03645b89161cd4351b386fd664acc27a5e1408 -r2650526158a18c2ac5bf518957e5fa260d882538 --- Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision ef03645b89161cd4351b386fd664acc27a5e1408) +++ Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision 2650526158a18c2ac5bf518957e5fa260d882538) @@ -208,32 +208,6 @@ } [Test] - public void GetScratchPadPath_WithSubPathAndScratchPadFolderDoesntExist_ThrowIOException() - { - // Setup - string actualPath = TestHelper.GetScratchPadPath(); - - Directory.Delete(actualPath, true); - - try - { - string subPath = Path.Combine("test", "1.234"); - - // Call - TestDelegate call = () => TestHelper.GetScratchPadPath(subPath); - - // Assert - string message = Assert.Throws(call).Message; - const string expectedMessage = "The 'Scratchpad' folder has been deleted from the trunk, while tests require the existence of this folder for writing to disk temporarily."; - Assert.AreEqual(expectedMessage, message); - } - finally - { - Directory.CreateDirectory(actualPath); - } - } - - [Test] public void GetTestDataPath_Always_VerifiedTestPaths() { string path = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Storage); Index: Core/Components/src/Core.Components.DotSpatial.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r9c1789fd6fa33b6ea18339bf2474102471ef4510 -r2650526158a18c2ac5bf518957e5fa260d882538 --- Core/Components/src/Core.Components.DotSpatial.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 9c1789fd6fa33b6ea18339bf2474102471ef4510) +++ Core/Components/src/Core.Components.DotSpatial.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2650526158a18c2ac5bf518957e5fa260d882538) @@ -193,7 +193,7 @@ } /// - /// Looks up a localized string similar to Het is niet mogelijk om WMTS connectie {0} aan te maken met URL '{1}'.. + /// Looks up a localized string similar to Het is niet mogelijk om WMTS connectie '{0}' aan te maken met URL '{1}'.. /// public static string WmtsConnectionInfoReader_Unable_To_Create_WmtsConnectionInfo { get { Index: Core/Components/src/Core.Components.DotSpatial.Forms/Properties/Resources.resx =================================================================== diff -u -r336c86d498d517c66d854fc0e91a6a06f1e582c2 -r2650526158a18c2ac5bf518957e5fa260d882538 --- Core/Components/src/Core.Components.DotSpatial.Forms/Properties/Resources.resx (.../Resources.resx) (revision 336c86d498d517c66d854fc0e91a6a06f1e582c2) +++ Core/Components/src/Core.Components.DotSpatial.Forms/Properties/Resources.resx (.../Resources.resx) (revision 2650526158a18c2ac5bf518957e5fa260d882538) @@ -145,7 +145,7 @@ WMTS locatie aanpassen - Het is niet mogelijk om WMTS connectie {0} aan te maken met URL '{1}'. + Het is niet mogelijk om WMTS connectie '{0}' aan te maken met URL '{1}'. Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoReaderTest.cs =================================================================== diff -u -r27a3de13b3b94459fc79664d521de3790dd6b0df -r2650526158a18c2ac5bf518957e5fa260d882538 --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoReaderTest.cs (.../WmtsConnectionInfoReaderTest.cs) (revision 27a3de13b3b94459fc79664d521de3790dd6b0df) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/IO/WmtsConnectionInfoReaderTest.cs (.../WmtsConnectionInfoReaderTest.cs) (revision 2650526158a18c2ac5bf518957e5fa260d882538) @@ -81,7 +81,7 @@ TestDelegate call = () => reader.ReadWmtsConnectionInfos(filePath); // Assert - var expectedMessage = "Fout bij het lezen van bestand 'c:/\".config': " + var expectedMessage = $"Fout bij het lezen van bestand '{filePath}': " + "er zitten ongeldige tekens in het bestandspad. Alle tekens in het bestandspad moeten geldig zijn."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } @@ -184,7 +184,7 @@ Action action = () => { readConnectionInfos = reader.ReadWmtsConnectionInfos(filePath).ToArray(); }; // Assert - string expectedMessage = $"Fout bij het lezen van bestand '{filePath}': het is niet mogelijk om WMTS connectie First name aan te maken met URL ''."; + string expectedMessage = $"Fout bij het lezen van bestand '{filePath}': het is niet mogelijk om WMTS connectie 'First name' aan te maken met URL ''."; TestHelper.AssertLogMessageWithLevelIsGenerated(action, Tuple.Create(expectedMessage, LogLevelConstant.Warn)); Assert.IsNotNull(readConnectionInfos); Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/Views/WmtsConnectionDialogTest.cs =================================================================== diff -u -re4420909e17303174748bd196766fd95e14aae93 -r2650526158a18c2ac5bf518957e5fa260d882538 --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/Views/WmtsConnectionDialogTest.cs (.../WmtsConnectionDialogTest.cs) (revision e4420909e17303174748bd196766fd95e14aae93) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/Views/WmtsConnectionDialogTest.cs (.../WmtsConnectionDialogTest.cs) (revision 2650526158a18c2ac5bf518957e5fa260d882538) @@ -247,11 +247,10 @@ // Setup const string urltextbox = @"urlTextBox"; const string nametextbox = @"nameTextBox"; - var dialogResult = DialogResult.None; DialogBoxHandler = (formName, wnd) => { - using (var formTester = new FormTester(formName)) + using (new FormTester(formName)) { var nameTextBox = (TextBox) new TextBoxTester("nameTextBox", formName).TheObject; var urlTextBox = (TextBox) new TextBoxTester("urlTextBox", formName).TheObject; @@ -262,15 +261,13 @@ // Call actionButton.Click(); - - dialogResult = formTester.DialogResult; } }; using (var dialogParent = new Form()) using (var dialog = new WmtsConnectionDialog(dialogParent)) { - dialog.ShowDialog(); + DialogResult dialogResult = dialog.ShowDialog(); // Assert Assert.AreEqual(nametextbox, dialog.WmtsConnectionName); @@ -300,13 +297,14 @@ using (var dialog = new WmtsConnectionDialog(dialogParent)) { // When - dialog.ShowDialog(); + DialogResult dialogResult = dialog.ShowDialog(); // Then Assert.IsNull(dialog.WmtsConnectionName); Assert.IsNull(dialog.WmtsConnectionUrl); Assert.AreEqual(dialog.CancelButton, cancelButton); + Assert.AreEqual(DialogResult.Cancel, dialogResult); } } Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/Views/WmtsLocationControlTest.cs =================================================================== diff -u -r8ed20afbbecb8d353372e6623e7bbf68cdee543c -r2650526158a18c2ac5bf518957e5fa260d882538 --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/Views/WmtsLocationControlTest.cs (.../WmtsLocationControlTest.cs) (revision 8ed20afbbecb8d353372e6623e7bbf68cdee543c) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/Views/WmtsLocationControlTest.cs (.../WmtsLocationControlTest.cs) (revision 2650526158a18c2ac5bf518957e5fa260d882538) @@ -130,7 +130,7 @@ var urlLocations = (ComboBox) new ComboBoxTester("urlLocationComboBox", form).TheObject; Assert.AreEqual(ComboBoxStyle.DropDownList, urlLocations.DropDownStyle); - Assert.IsInstanceOf>(urlLocations.DataSource); + Assert.IsInstanceOf>(urlLocations.DataSource); Assert.AreEqual("Name", urlLocations.DisplayMember); Assert.AreEqual("Url", urlLocations.ValueMember); Assert.IsTrue(urlLocations.Sorted); @@ -204,26 +204,26 @@ var dataGridViewControl = (DataGridViewControl) new ControlTester("dataGridViewControl", form).TheObject; var dataGridView = dataGridViewControl.Controls.OfType().First(); - Assert.AreEqual(DataGridViewSelectionMode.FullRowSelect, dataGridView.SelectionMode); - Assert.IsFalse(dataGridView.MultiSelect); + Assert.AreEqual(DataGridViewSelectionMode.FullRowSelect, dataGridViewControl.SelectionMode); + Assert.IsFalse(dataGridViewControl.MultiSelect); Assert.AreEqual(4, dataGridView.ColumnCount); - var mapLayerIdColumn = (DataGridViewTextBoxColumn) dataGridView.Columns[mapLayerIdColumnIndex]; + var mapLayerIdColumn = (DataGridViewTextBoxColumn) dataGridViewControl.GetColumnFromIndex(mapLayerIdColumnIndex); Assert.AreEqual("Kaartlaag", mapLayerIdColumn.HeaderText); Assert.AreEqual("Id", mapLayerIdColumn.DataPropertyName); Assert.IsTrue(mapLayerIdColumn.ReadOnly); - var mapLayerFormatColumn = (DataGridViewTextBoxColumn) dataGridView.Columns[mapLayerFormatColumnIndex]; + var mapLayerFormatColumn = (DataGridViewTextBoxColumn) dataGridViewControl.GetColumnFromIndex(mapLayerFormatColumnIndex); Assert.AreEqual("Formaat", mapLayerFormatColumn.HeaderText); Assert.AreEqual("Format", mapLayerFormatColumn.DataPropertyName); Assert.IsTrue(mapLayerFormatColumn.ReadOnly); - var mapLayerTitleColumn = (DataGridViewTextBoxColumn) dataGridView.Columns[mapLayerTitleColumnIndex]; + var mapLayerTitleColumn = (DataGridViewTextBoxColumn) dataGridViewControl.GetColumnFromIndex(mapLayerTitleColumnIndex); Assert.AreEqual("Titel", mapLayerTitleColumn.HeaderText); Assert.AreEqual("Title", mapLayerTitleColumn.DataPropertyName); Assert.IsTrue(mapLayerTitleColumn.ReadOnly); - var mapLayerCoordinateSystemColumn = (DataGridViewTextBoxColumn) dataGridView.Columns[mapLayerCoordinateSystemColumnIndex]; + var mapLayerCoordinateSystemColumn = (DataGridViewTextBoxColumn) dataGridViewControl.GetColumnFromIndex(mapLayerCoordinateSystemColumnIndex); Assert.AreEqual("Coördinatenstelsel", mapLayerCoordinateSystemColumn.HeaderText); Assert.AreEqual("CoordinateSystem", mapLayerCoordinateSystemColumn.DataPropertyName); Assert.IsTrue(mapLayerCoordinateSystemColumn.ReadOnly); @@ -322,14 +322,13 @@ { ApplicationLocalUserSettingsDirectory = TestHelper.GetTestDataPath(testPath, "noConfig") })) + using (var form = new Form()) { // Call - using (WmtsLocationControl control = ShowFullyConfiguredWmtsLocationControl()) + using (ShowFullyConfiguredWmtsLocationControl(form)) { - Form form = control.FindForm(); - // Assert - var dataGridViewControl = (DataGridViewControl) new ControlTester("dataGridViewControl", form).TheObject; + var dataGridViewControl = (DataGridViewControl)new ControlTester("dataGridViewControl", form).TheObject; DataGridViewRowCollection rows = dataGridViewControl.Rows; Assert.AreEqual(2, rows.Count); @@ -383,7 +382,8 @@ { ApplicationLocalUserSettingsDirectory = TestHelper.GetTestDataPath(testPath, "noConfig") })) - using (WmtsLocationControl control = ShowFullyConfiguredWmtsLocationControl()) + using (var form = new Form()) + using (WmtsLocationControl control = ShowFullyConfiguredWmtsLocationControl(form)) { // Call MapData selectedMapData = control.SelectedMapData; @@ -394,36 +394,6 @@ } [Test] - public void GetSelectedMapData_WithoutSelectedComboBoxWithSelectedRow_ReturnsNull() - { - // Setup - mockRepository.ReplayAll(); - - using (new UseCustomTileSourceFactoryConfig(tileFactory)) - using (var form = new Form()) - using (var control = new WmtsLocationControl(null)) - { - form.Controls.Add(control); - form.Show(); - - var dataGridViewControl = (DataGridViewControl) new ControlTester("dataGridViewControl", form).TheObject; - dataGridViewControl.SetDataSource(new[] - { - new WmtsCapabilityRow(new WmtsCapability("-", "image/png", "-", "-")) - }); - - var dataGridView = dataGridViewControl.Controls.OfType().First(); - dataGridView.CurrentCell = dataGridView.Rows[0].Cells[0]; - - // Call - WmtsMapData selectedMapData = control.SelectedMapData; - - // Assert - Assert.IsNull(selectedMapData); - } - } - - [Test] public void GetSelectedMapData_WithSelectedData_ReturnsSelectedMapData() { // Setup @@ -435,12 +405,11 @@ { ApplicationLocalUserSettingsDirectory = TestHelper.GetTestDataPath(testPath, "noConfig") })) - using (WmtsLocationControl control = ShowFullyConfiguredWmtsLocationControl()) + using (var form = new Form()) + using (WmtsLocationControl control = ShowFullyConfiguredWmtsLocationControl(form)) { - Form form = control.FindForm(); - var dataGridViewControl = (DataGridViewControl) new ControlTester("dataGridViewControl", form).TheObject; - var dataGridView = dataGridViewControl.Controls.OfType().First(); - dataGridView.CurrentCell = dataGridView.Rows[1].Cells[0]; + var dataGridViewControl = (DataGridViewControl)new ControlTester("dataGridViewControl", form).TheObject; + dataGridViewControl.SetCurrentCell(dataGridViewControl.GetCell(1, 0)); // Call WmtsMapData selectedMapData = control.SelectedMapData; @@ -843,66 +812,6 @@ } [Test] - [Apartment(ApartmentState.STA)] - public void GivenWmtsLocationControlAndEditLocationClicked_WhenInValidDataInDialog_ThenWmtsLocationsNotUpdated() - { - // Given - tileFactory.Expect(tf => tf.GetWmtsTileSources(null)).IgnoreArguments().Return(Enumerable.Empty()); - mockRepository.ReplayAll(); - - DialogBoxHandler = (formName, wnd) => - { - using (var formTester = new FormTester(formName)) - { - var dialog = (WmtsConnectionDialog) formTester.TheObject; - var nameTextBox = (TextBox) new TextBoxTester("nameTextBox", dialog).TheObject; - var urlTextBox = (TextBox) new TextBoxTester("urlTextBox", dialog).TheObject; - var actionButtonTester = new ButtonTester("actionButton", dialog); - var actionButton = (Button) actionButtonTester.TheObject; - - nameTextBox.Text = ""; - urlTextBox.Text = ""; - actionButton.Enabled = true; - actionButtonTester.Click(); - } - }; - - using (new UseCustomSettingsHelper(new TestSettingsHelper - { - ApplicationLocalUserSettingsDirectory = TestHelper.GetTestDataPath(testPath, "noConfig") - })) - using (new UseCustomTileSourceFactoryConfig(tileFactory)) - using (var form = new Form()) - using (var control = new WmtsLocationControl(null)) - { - form.Controls.Add(control); - form.Show(); - - var comboBox = (ComboBox) new ComboBoxTester("urlLocationComboBox", form).TheObject; - comboBox.DataSource = new List - { - new WmtsConnectionInfo("oldName", "oldUrl") - }; - - var editLocationButton = new ButtonTester("editLocationButton", form); - ((Button) editLocationButton.TheObject).Enabled = true; - - // When - editLocationButton.Click(); - - // Then - var dataSource = (List) comboBox.DataSource; - Assert.AreEqual(1, dataSource.Count); - var item = (WmtsConnectionInfo) comboBox.Items[0]; - Assert.AreEqual("oldName", item.Name); - Assert.AreEqual("oldUrl", item.Url); - - var connectToButton = (Button) new ButtonTester("connectToButton", form).TheObject; - Assert.IsFalse(connectToButton.Enabled); - } - } - - [Test] public void GivenWmtsLocationControlAndConnectClicked_WhenValidDataFromUrl_ThenDataGridUpdated() { // Given @@ -911,18 +820,17 @@ WmtsMapData backgroundMapData = WmtsMapData.CreateDefaultPdokMapData(); using (new UseCustomTileSourceFactoryConfig(backgroundMapData)) - using (WmtsLocationControl control = ShowValidWmtsLocationControl()) + using (var form = new Form()) + using (ShowValidWmtsLocationControl(form)) { - Form form = control.FindForm(); - form?.Show(); - + form.Show(); var connectToButton = new ButtonTester("connectToButton", form); // When connectToButton.Click(); // Then - var dataGridViewControl = (DataGridViewControl) new ControlTester("dataGridViewControl", form).TheObject; + var dataGridViewControl = (DataGridViewControl)new ControlTester("dataGridViewControl", form).TheObject; DataGridViewRowCollection rows = dataGridViewControl.Rows; Assert.AreEqual(1, rows.Count); @@ -956,11 +864,10 @@ }; using (new UseCustomTileSourceFactoryConfig(tileFactory)) - using (WmtsLocationControl control = ShowValidWmtsLocationControl()) + using (var form = new Form()) + using (ShowValidWmtsLocationControl(form)) { - Form form = control.FindForm(); - form?.Show(); - + form.Show(); var connectToButton = new ButtonTester("connectToButton", form); // When @@ -1008,10 +915,9 @@ Assert.AreEqual(expected.SourceCapabilitiesUrl, actual.SourceCapabilitiesUrl); } - private WmtsLocationControl ShowFullyConfiguredWmtsLocationControl() + private static WmtsLocationControl ShowFullyConfiguredWmtsLocationControl(Form form) { - WmtsLocationControl control = ShowValidWmtsLocationControl(); - Form form = control.FindForm(); + WmtsLocationControl control = ShowValidWmtsLocationControl(form); var capabilities = new List { @@ -1025,9 +931,8 @@ return control; } - private WmtsLocationControl ShowValidWmtsLocationControl() + private static WmtsLocationControl ShowValidWmtsLocationControl(Form form) { - var form = new Form(); var control = new WmtsLocationControl(null); form.Controls.Add(control);