using System; using NUnit.Framework; using Deltares.Dam.Data; using System.IO; namespace Deltares.Dam.Tests { [TestFixture] public class StabilityServiceAgentTest { private const string NormalTestFile = @"..\..\..\data\dam\mstabfiles\zuivering Gendt.sti"; private const string BadTestFile = @"..\..\..\data\dam\mstabfiles\BadInputFile.sti"; private StabilityServiceAgent agent; [TestFixtureSetUp] public void FixtureSetup() { agent = new StabilityServiceAgent(); } [Test] public void CanPerformCalculation() { var result = agent.ExtractStabilityResults(NormalTestFile); Assert.GreaterOrEqual(1.276, result.zone1.safetyFactor); } [Test] [ExpectedException(typeof(FileNotFoundException))] public void ThrowsFileExceptionUsingProjectFileThatNotExists() { agent.ExtractStabilityResults("teG1_ute7st.sti"); } [Test] [ExpectedException(typeof(ArgumentException))] public void ThrowsExceptionWhenProjectFileIsEmpty() { agent.ExtractStabilityResults(""); } [Test] [ExpectedException(typeof(ArgumentException))] public void ThrowsExceptionWhenProjectFileNameContainsOnlySpaces() { agent.ExtractStabilityResults(" "); } [Test] [ExpectedException(typeof(ArgumentException))] public void ThrowsExceptionWhenProjectFileNameIsNull() { agent.ExtractStabilityResults(null); } [Test] [ExpectedException(typeof(StabilityServiceAgentException))] public void ThrowsExceptionWhenOutputFileIsNotFound() { agent.ExtractStabilityResults(BadTestFile); } } }