Index: Core/Components/test/Core.Components.Gis.Forms.Test/Views/WmtsLocationControlTest.cs =================================================================== diff -u -r9e9976818f1b446948c3bf815cafe2e023f98ac1 -r7156a7616be48953df2cd8e10ffadcacb89ca964 --- Core/Components/test/Core.Components.Gis.Forms.Test/Views/WmtsLocationControlTest.cs (.../WmtsLocationControlTest.cs) (revision 9e9976818f1b446948c3bf815cafe2e023f98ac1) +++ Core/Components/test/Core.Components.Gis.Forms.Test/Views/WmtsLocationControlTest.cs (.../WmtsLocationControlTest.cs) (revision 7156a7616be48953df2cd8e10ffadcacb89ca964) @@ -1,960 +1,960 @@ -// Copyright (C) Stichting Deltares 2022. All rights reserved. -// -// This file is part of Riskeer. -// -// Riskeer is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser 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 System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using System.Windows.Forms; -using BruTile; -using BruTile.Wmts; -using Core.Common.Controls.DataGrid; -using Core.Common.TestUtil; -using Core.Common.Util.Settings; -using Core.Common.Util.TestUtil.Settings; -using Core.Components.BruTile.Configurations; -using Core.Components.BruTile.TestUtil; -using Core.Components.Gis.Data; -using Core.Components.Gis.Exceptions; -using Core.Components.Gis.Forms.Views; -using Core.Components.Gis.TestUtil; -using NUnit.Extensions.Forms; -using NUnit.Framework; -using Rhino.Mocks; - -namespace Core.Components.Gis.Forms.Test.Views -{ - [TestFixture] - public class WmtsLocationControlTest : NUnitFormTest - { - private const int mapLayerIdColumnIndex = 0; - private const int mapLayerFormatColumnIndex = 1; - private const int mapLayerTitleColumnIndex = 2; - private const int mapLayerCoordinateSystemColumnIndex = 3; - private const string wmtsconnectioninfoConfigFile = "wmtsConnectionInfo.config"; - - private static readonly TestDataPath testPath = TestDataPath.Core.Components.Gis.IO; - - private MockRepository mockRepository; - private ITileSourceFactory tileFactory; - private IWmtsCapabilityFactory wmtsCapabilityFactory; - - [Test] - public void Constructor_WmtsCapabilityFactoryNull_ThrowArgumentNullException() - { - // Setup - mockRepository.ReplayAll(); - - // Call - TestDelegate test = () => new WmtsLocationControl(null, null); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("wmtsCapabilityFactory", exception.ParamName); - } - - [Test] - public void Constructor_WithFactory_DefaultValues() - { - // Setup - mockRepository.ReplayAll(); - - using (new UseCustomTileSourceFactoryConfig(tileFactory)) - { - // Call - using (var control = new WmtsLocationControl(null, wmtsCapabilityFactory)) - { - // Assert - Assert.IsInstanceOf(control); - Assert.IsInstanceOf(control); - Assert.AreEqual("Web Map Tile Service (WMTS)", control.DisplayName); - Assert.IsNull(control.SelectedMapData); - } - } - } - - [Test] - public void Constructor_WithFactory_DataGridViewCorrectlyInitialized() - { - // Setup - mockRepository.ReplayAll(); - - using (new UseCustomTileSourceFactoryConfig(tileFactory)) - { - // Call - using (var control = new WmtsLocationControl(null, wmtsCapabilityFactory)) - using (var form = new Form()) - { - form.Controls.Add(control); - - // Assert - DataGridViewControl dataGridViewControl = form.Controls.Find("dataGridViewControl", true).OfType().First(); - DataGridView dataGridView = dataGridViewControl.Controls.OfType().First(); - - Assert.AreEqual(DataGridViewSelectionMode.FullRowSelect, dataGridViewControl.SelectionMode); - Assert.IsFalse(dataGridViewControl.MultiSelect); - Assert.AreEqual(4, dataGridView.ColumnCount); - - var mapLayerIdColumn = (DataGridViewTextBoxColumn) dataGridViewControl.GetColumnFromIndex(mapLayerIdColumnIndex); - Assert.AreEqual("Kaartlaag", mapLayerIdColumn.HeaderText); - Assert.AreEqual("Id", mapLayerIdColumn.DataPropertyName); - Assert.IsTrue(mapLayerIdColumn.ReadOnly); - - var mapLayerFormatColumn = (DataGridViewTextBoxColumn) dataGridViewControl.GetColumnFromIndex(mapLayerFormatColumnIndex); - Assert.AreEqual("Formaat", mapLayerFormatColumn.HeaderText); - Assert.AreEqual("Format", mapLayerFormatColumn.DataPropertyName); - Assert.IsTrue(mapLayerFormatColumn.ReadOnly); - - var mapLayerTitleColumn = (DataGridViewTextBoxColumn) dataGridViewControl.GetColumnFromIndex(mapLayerTitleColumnIndex); - Assert.AreEqual("Titel", mapLayerTitleColumn.HeaderText); - Assert.AreEqual("Title", mapLayerTitleColumn.DataPropertyName); - Assert.IsTrue(mapLayerTitleColumn.ReadOnly); - - var mapLayerCoordinateSystemColumn = (DataGridViewTextBoxColumn) dataGridViewControl.GetColumnFromIndex(mapLayerCoordinateSystemColumnIndex); - Assert.AreEqual("Coördinatenstelsel", mapLayerCoordinateSystemColumn.HeaderText); - Assert.AreEqual("CoordinateSystem", mapLayerCoordinateSystemColumn.DataPropertyName); - Assert.IsTrue(mapLayerCoordinateSystemColumn.ReadOnly); - - CollectionAssert.IsEmpty(dataGridViewControl.Rows); - - Label urlLocationLabel = form.Controls.Find("urlLocationLabel", true).OfType