using System.Collections.Generic; using System.IO; using System.Linq; using Deltares.Dam.Data.IO; using Deltares.Maps; using NUnit.Framework; namespace Deltares.Dam.Tests.IO { [TestFixture] public class ShapeFileExporterTest { #region Setup [TestFixtureSetUp] public void FixtureSetup() { } [TestFixtureTearDown] public void FixtureTearDown() { } [SetUp] public void TestSetup() { } [TearDown] public void TestTearDown() { } #endregion [Test] [Ignore("ShapeFile writing bug needs to be solved to make this test succeed")] public void Export_UsingValidDataAndPreCondionsAreMet_FilesAreWrittenAnCanBeRead() { const string name = "SafetyFactor"; const string path = "."; foreach(var file in Directory.GetFiles(path, name + ".*")) { File.Delete(file); } const string attrName = "SAFETYFACT"; var repository = new FeatureRepository(); repository.Add( Feature.Create( "POINT(1 1)", new Dictionary { {attrName, 1.7} } )); // Actual test var exporter = new ShapeFileExporter(name, path, repository); exporter.Export(); var fileLocation = new ShapeFileLocation(path, name); // Reading data back to verify the export var retrievedRepository = FeatureRepository.CreateFromShapeFile(fileLocation); Assert.IsNotNull(retrievedRepository); var retrievedFeature = retrievedRepository.Features.ElementAt(0); Assert.AreEqual(1.7, retrievedFeature.Attributes[attrName]); } } }