Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj =================================================================== diff -u -r3006 -r3007 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 3006) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 3007) @@ -200,7 +200,7 @@ - + Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/StiFileReader.cs =================================================================== diff -u -r3006 -r3007 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/StiFileReader.cs (.../StiFileReader.cs) (revision 3006) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/StiFileReader.cs (.../StiFileReader.cs) (revision 3007) @@ -16,7 +16,7 @@ /// /// The file path to read from. /// A . - /// Thrown when + /// Thrown when /// could not be read successfully. /// This only reads the names and the geometry of the soil layers. public SoilProfile2D ReadSoilProfile(string filePath) @@ -30,7 +30,7 @@ { LogManager.Add(new LogMessage(LogMessageType.Error, this, message)); } - throw new StiFileImporterException($"'{filePath}' is an unsupported file."); + throw new StiFileReadException($"'{filePath}' is an unsupported file."); } try @@ -40,7 +40,7 @@ } catch (Exception e) { - throw new StiFileImporterException($"Reading file failed: {e.Message}.", e); + throw new StiFileReadException($"Reading file failed: {e.Message}.", e); } } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/StiFileValidator.cs =================================================================== diff -u -r2999 -r3007 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/StiFileValidator.cs (.../StiFileValidator.cs) (revision 2999) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/StiFileValidator.cs (.../StiFileValidator.cs) (revision 3007) @@ -55,8 +55,7 @@ /// The file path of the file to validate. /// Thrown when /// is null or consists of whitespaces. - /// Thrown when the validator - /// could not be created. + /// Thrown when the validator could not be created. public StiFileValidator(string filePath) { if (string.IsNullOrWhiteSpace(filePath)) @@ -110,7 +109,7 @@ /// /// The file path to read the file contents from. /// A collection of strings of the file content. - /// Thrown when the content could not be read successfully. + /// Thrown when the content could not be read successfully. private static List ReadFileContent(string filePath) { try @@ -120,7 +119,7 @@ } catch (IOException e) { - throw new StiFileImporterException(e.Message, e); + throw new StiFileReadException(e.Message, e); } } Index: DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/StiFileValidatorTest.cs =================================================================== diff -u -r3006 -r3007 --- DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/StiFileValidatorTest.cs (.../StiFileValidatorTest.cs) (revision 3006) +++ DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/StiFileValidatorTest.cs (.../StiFileValidatorTest.cs) (revision 3007) @@ -54,7 +54,7 @@ } [Test] - public void Constructor_FileResultsInIOException_ThrowsStiFileImporterException() + public void Constructor_FileResultsInIOException_ThrowsStiFileReadException() { // Setup const string nonExistingFile = "DoesNotExist"; @@ -63,7 +63,7 @@ TestDelegate call = () => new StiFileValidator(nonExistingFile); // Assert - var exception = Assert.Throws(call); + var exception = Assert.Throws(call); Exception innerException = exception.InnerException; Assert.That(innerException, Is.InstanceOf()); Assert.That(exception.Message, Is.EqualTo(innerException.Message)); @@ -102,7 +102,7 @@ [Test] [TestCaseSource(nameof(GetUnsupportedFileVersions))] - public void GivenValidatorWithUnsupportedFileVersions_WhenValidateFileVersionCalled_ThenStiFileImporterExceptionThrown( + public void GivenValidatorWithUnsupportedFileVersions_WhenValidateFileVersionCalled_ThenLogMessagesGenerated( string fileName, string propertyName) { @@ -124,7 +124,7 @@ [Test] [TestCase("GeoFile.geo")] [TestCase("SeepFile.SEI")] - public void GivenValidatorWithUnsupportedFormat_WhenValidateFileFormatCalled_ThenStiFileImporterExceptionThrown(string fileName) + public void GivenValidatorWithUnsupportedFormat_WhenValidateFileFormatCalled_ThenLogMessagesGenerated(string fileName) { // Given string filePath = Path.Combine(testDataFolder, fileName); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/StiFileImporterException.cs =================================================================== diff -u -r2999 -r3007 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/StiFileImporterException.cs (.../StiFileImporterException.cs) (revision 2999) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/StiFileImporterException.cs (.../StiFileReadException.cs) (revision 3007) @@ -25,41 +25,41 @@ namespace Deltares.Dam.Data.StiImporter { /// - /// Exception thrown when something went importing a sti file went wrong. + /// Exception thrown when something went reading a sti file went wrong. /// [Serializable] - public class StiFileImporterException : Exception + public class StiFileReadException : Exception { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public StiFileImporterException() + public StiFileReadException() { } /// - /// Initializes a new instance of the class + /// Initializes a new instance of the class /// with a specified error message. /// /// The message that describes the error. - public StiFileImporterException(string message) + public StiFileReadException(string message) : base(message) { } /// - /// Initializes a new instance of the class with a specified error message + /// Initializes a new instance of the class with a specified error message /// and a reference to the inner exception that is the cause of this exception. /// /// The error message that explains the reason for the exception. /// The exception that is the cause of the current exception, /// or null if no inner exception is specified. - public StiFileImporterException(string message, Exception innerException) : base(message, innerException) + public StiFileReadException(string message, Exception innerException) : base(message, innerException) { } /// - /// Initializes a new instance of with + /// Initializes a new instance of with /// serialized data. /// The that holds the serialized /// object data about the exception being thrown. @@ -69,7 +69,7 @@ /// null. /// The class name is null or /// is zero (0). - protected StiFileImporterException(SerializationInfo info, StreamingContext context) : base(info, context) + protected StiFileReadException(SerializationInfo info, StreamingContext context) : base(info, context) { } } Fisheye: Tag 3007 refers to a dead (removed) revision in file `DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/StiFileImporterException.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/StiFileReaderTest.cs =================================================================== diff -u -r3006 -r3007 --- DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/StiFileReaderTest.cs (.../StiFileReaderTest.cs) (revision 3006) +++ DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/StiFileReaderTest.cs (.../StiFileReaderTest.cs) (revision 3007) @@ -39,9 +39,27 @@ private const string TestDataFolder = @"TestData\StiImporter\"; [Test] - public void ReadSoilProfile_WithInvalidVersion_ThrowsStiFileImporterException() + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] + public void ReadSoilProfile_WithInvalidFilePath_ThrowsArgumentException(string invalidFilePath) { // Setup + var reader = new StiFileReader(); + + // Call + TestDelegate call = () => reader.ReadSoilProfile(invalidFilePath); + + // Assert + Assert.That(call, Throws.ArgumentException + .With.Message.EqualTo("'filePath' cannot be null or consist of whitespaces only.")); + + } + + [Test] + public void ReadSoilProfile_WithInvalidVersion_ThrowsStiFileReadException() + { + // Setup string filePath = Path.Combine(TestDataFolder, "InvalidSoilVersion.sti"); var reader = new StiFileReader(); @@ -50,7 +68,7 @@ TestDelegate call = () => reader.ReadSoilProfile(filePath); // Assert - Assert.That(call, Throws.Exception.TypeOf() + Assert.That(call, Throws.Exception.TypeOf() .With.Message.EqualTo($"'{filePath}' is an unsupported file.")); string expectedMessage = $"Soil data in '{filePath}' is of a version of D-Geo Stability that is not supported and cannot be read"; @@ -103,7 +121,7 @@ } [Test] - public void ReadSoilProfile_WithInvalidFile_ThrowsSoilImporterException() + public void ReadSoilProfile_WithInvalidFile_ThrowsStiFileReadException() { // Setup string filePath = Path.Combine(TestDataFolder, "SimpleProfileWithException.sti"); // This file contains more coordinates than the maximum specified @@ -114,7 +132,7 @@ TestDelegate call = () => reader.ReadSoilProfile(filePath); // Assert - var exception = Assert.Throws(call); + var exception = Assert.Throws(call); Exception innerException = exception.InnerException; Assert.That(innerException, Is.Not.Null); Assert.That(exception.Message, Is.EqualTo($"Reading file failed: {innerException.Message}."));