// 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 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.Linq;
using System.Windows.Forms;
using Core.Common.Base.Geometry;
using Core.Components.DotSpatial.TestUtil;
using Core.Components.Gis.Data;
using DotSpatial.Controls;
using NUnit.Framework;
using IMap = Core.Components.Gis.IMap;
namespace Core.Components.DotSpatial.Forms.Test
{
[TestFixture]
public class BaseMapTest
{
[Test]
public void DefaultConstructor_DefaultValues()
{
// Call
var map = new BaseMap();
// Assert
Assert.IsInstanceOf(map);
Assert.IsInstanceOf(map);
Assert.IsNull(map.Data);
}
[Test]
public void Data_UnknownMapData_ThrowsNotSupportedException()
{
// Setup
var map = new BaseMap();
var testData = new TestMapData();
// Call
TestDelegate test = () => map.Data = testData;
// Assert
Assert.Throws(test);
}
[Test]
public void Data_Null_ReturnsNull()
{
// Setup
var map = new BaseMap();
// Call
map.Data = null;
// Assert
Assert.IsNull(map.Data);
}
[Test]
public void Data_NotNull_ReturnsData()
{
// Setup
var map = new BaseMap();
var testData = new MapPointData(Enumerable.Empty());
// Call
map.Data = testData;
// Assert
Assert.AreSame(testData, map.Data);
}
[Test]
public void Data_SetPointData_MapPointLayerAdded()
{
// Setup
var map = new BaseMap();
var testData = new MapPointData(Enumerable.Empty());
var mapView = map.Controls.OfType