using System.Collections.Generic; using System.IO; using Deltares.Dam.Data; using Deltares.Dam.Data.Exporters; using NUnit.Framework; using Rhino.Mocks; namespace Deltares.Dam.Tests.Exporters { [TestFixture] public class ScenarioExporterTest { private const string FileNameWithoutExtension = "ScenarioExportTestFile"; private const string FileName = FileNameWithoutExtension + ".shp"; private MockRepository mocks;private IScenarioExporter exporter; private ILocationJob job; #region Setup [TestFixtureSetUp] public void FixtureSetup() { mocks = new MockRepository(); job = mocks.DynamicMock(); // remove old files var files = Directory.GetFiles(Directory.GetCurrentDirectory(), FileNameWithoutExtension + "*.*"); foreach (var file in files) { File.Delete(file); } } [TestFixtureTearDown] public void FixtureTearDown() { } [SetUp] public void TestSetup() { } [TearDown] public void TestTearDown() { mocks.VerifyAll(); } #endregion [Test] [Ignore("Need to fix shape file writing")] public void Export2ShapeFile_NormalScenario_ValidShapeFileExists() { var jobs = new List() { job }; using (var locationStubReturn = new Location() { XRd = 1.9, YRd = 2.5 }) { Expect.Call(job.Location).Return(locationStubReturn); Expect.Call(job.HasRWScenarioResults).Return(true); Expect.Call(job.RWScenarioResults).Return(new[] { new RWScenarioResult() { SafetyFactor = 1.7 } }); mocks.ReplayAll(); var file = new FileInfo(FileName); exporter = new ScenarioExporter(jobs, file); exporter.Export(); Assert.IsTrue(File.Exists(FileName)); // open and read/test the file contents?? } } } }