public void Parse_WorkingDirectoryNull_ThrowsArgumentNullException() { // Setup var parser = new WaveConditionsCalculationParser(); // Call TestDelegate test = () => parser.Parse(null, 1); // Assert var exception = Assert.Throws <ArgumentNullException>(test); Assert.AreEqual("workingDirectory", exception.ParamName); }
public void Parse_WithWorkingDirectoryWithoutExpectedFile_ThrowsHydraRingFileParserException() { // Setup string path = Path.Combine(testDirectory, "EmptyWorkingDirectory"); var parser = new WaveConditionsCalculationParser(); // Call TestDelegate test = () => parser.Parse(path, 1); // Assert var exception = Assert.Throws <HydraRingFileParserException>(test); Assert.IsInstanceOf <SQLiteException>(exception.InnerException); }
public void Parse_ResultsOnOtherSection_ThrowsHydraRingFileParserException() { // Setup string path = Path.Combine(testDirectory, "OtherSection"); var parser = new WaveConditionsCalculationParser(); // Call TestDelegate test = () => parser.Parse(path, 1); // Assert var exception = Assert.Throws <HydraRingFileParserException>(test); Assert.AreEqual("Er zijn geen berekende golfcondities gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); }
public void Parse_WithWorkingDirectoryWithInvalidOutputFile_ThrowsHydraRingFileParserException() { // Setup string path = Path.Combine(testDirectory, "InvalidFile"); var parser = new WaveConditionsCalculationParser(); // Call TestDelegate test = () => parser.Parse(path, 1); // Assert var exception = Assert.Throws <HydraRingFileParserException>(test); Assert.AreEqual("Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase.", exception.Message); Assert.IsInstanceOf <SQLiteException>(exception.InnerException); }
public void Parse_ValidData_OutputSet() { // Setup string path = Path.Combine(testDirectory, validFile); var parser = new WaveConditionsCalculationParser(); // Call parser.Parse(path, 1); // Assert Assert.AreEqual(2.76672, parser.Output.WaveHeight); Assert.AreEqual(-7.97903, parser.Output.WaveAngle); Assert.AreEqual(292.021, parser.Output.WaveDirection); Assert.AreEqual(5.02556, parser.Output.WavePeakPeriod); }
public void Parse_NotAllColumnsHaveResults_ThrowsHydraRingFileParserException(string subFolder) { // Setup string path = Path.Combine(testDirectory, subFolder); var parser = new WaveConditionsCalculationParser(); // Call TestDelegate test = () => parser.Parse(path, 1); // Assert var exception = Assert.Throws <HydraRingFileParserException>(test); Assert.AreEqual("Er zijn geen berekende golfcondities gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); Assert.IsInstanceOf <InvalidCastException>(exception.InnerException); }
public void Parse_ErrorWhileReadingFile_ThrowsHydraRingFileParserException() { // Setup var parser = new WaveConditionsCalculationParser(); string workingDirectory = Path.Combine(testDirectory, validFile); using (new DirectoryPermissionsRevoker(testDirectory, FileSystemRights.ReadData)) { // Call TestDelegate call = () => parser.Parse(workingDirectory, 1); // Assert var exception = Assert.Throws <HydraRingFileParserException>(call); const string expectedMessage = "Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase."; Assert.AreEqual(expectedMessage, exception.Message); Assert.IsInstanceOf <SQLiteException>(exception.InnerException); } }