using System; using Deltares.Geometry; using Deltares.Maps; using NetTopologySuite.Geometries; using NUnit.Framework; namespace Deltares.Dam.Tests { [TestFixture] public class GeometryTest { private string geomWktTestString; #region Setup [TestFixtureSetUp] public void FixtureSetup() { this.geomWktTestString = "POLYGON ((199052.850615396 515952.801579154, 199050.859375 515952.937500002, 199050.948622814 515953.913886349, 199052.850615396 515952.801579154))"; } [TestFixtureTearDown] public void FixtureTearDown() { } [SetUp] public void TestSetup() { } [TearDown] public void TestTearDown() { } #endregion // [Test] // public void ClassIheritsSharpMapGeometry() // { // var geom = new Geometry(this.geomWktTestString); // Assert.IsNotNull(geom); // Assert.IsInstanceOfType(typeof(SharpGeom), geom); // } [Test] public void CanCreateGeometryFormWkt() { var geom = Feature.Create(this.geomWktTestString); Assert.IsNotNull(geom); Assert.AreEqual(this.geomWktTestString, geom.WktFormat); } [Test] public void CanCreateGeometryFormSharpMapGeom() { const string geomWkt = "POINT (0 0)"; var geom = Feature.Create(geomWkt); Assert.IsNotNull(geom); Assert.AreEqual(geomWkt, geom.WktFormat); Assert.IsInstanceOf(typeof(Point), geom.Geometry); } [Test] public void GeometryHasAnValidIdentity() { const string geomWkt = "POINT (0 0)"; var geom = Feature.Create(geomWkt); Assert.IsNotNull(geom); Assert.IsNotNull(geom.Id); Assert.AreNotEqual(geom.Id, Guid.Empty); } [Test] public void GeometryCanHoldAttributes() { const string geomWkt = "POINT (0 0)"; var geom = Feature.Create(geomWkt); Assert.IsNotNull(geom); const string testvalue = "testvalue"; geom.AddAttribute("test", testvalue); Assert.AreEqual(geom["test"], testvalue); } } }