Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.Designer.cs =================================================================== diff -u -r7a542dea56b0bcfbbd4dd6f2c6abcafcfaa5f753 -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7a542dea56b0bcfbbd4dd6f2c6abcafcfaa5f753) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -63,7 +63,7 @@ /// /// Looks up a localized string similar to /* ---------------------------------------------------- */ ////* Generated by Enterprise Architect Version 12.0 */ - ////* Created On : 13-jul-2016 16:03:28 */ + ////* Created On : 15-jul-2016 10:05:18 */ ////* DBMS : SQLite */ ////* ---------------------------------------------------- */ /// @@ -117,15 +117,6 @@ } /// - /// Looks up a localized string similar to Het bestand '{0}' is geen geldig Ringtoets bestand.. - /// - internal static string Error_Validating_Database_0 { - get { - return ResourceManager.GetString("Error_Validating_Database_0", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Een fout is opgetreden met schrijven naar het nieuwe Ringtoets bestand.. /// internal static string Error_Write_Structure_to_Database { Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.resx =================================================================== diff -u -r7a542dea56b0bcfbbd4dd6f2c6abcafcfaa5f753 -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.resx (.../Resources.resx) (revision 7a542dea56b0bcfbbd4dd6f2c6abcafcfaa5f753) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.resx (.../Resources.resx) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -130,9 +130,6 @@ Een fout is opgetreden met het updaten van het Ringtoets bestand. - - Het bestand '{0}' is geen geldig Ringtoets bestand. - Een fout is opgetreden met schrijven naar het nieuwe Ringtoets bestand. Index: Application/Ringtoets/src/Application.Ringtoets.Storage/StorageSqLite.cs =================================================================== diff -u -r7a542dea56b0bcfbbd4dd6f2c6abcafcfaa5f753 -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Application/Ringtoets/src/Application.Ringtoets.Storage/StorageSqLite.cs (.../StorageSqLite.cs) (revision 7a542dea56b0bcfbbd4dd6f2c6abcafcfaa5f753) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/StorageSqLite.cs (.../StorageSqLite.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -43,7 +43,6 @@ /// public class StorageSqLite : IStoreProject { - private string filePath; private string connectionString; public string FileFilter @@ -93,13 +92,13 @@ } catch (DataException exception) { - throw CreateStorageWriterException(Resources.Error_Update_Database, exception); + throw CreateStorageWriterException(databaseFilePath, Resources.Error_Update_Database, exception); } catch (SystemException exception) { if (exception is InvalidOperationException || exception is NotSupportedException) { - throw CreateStorageWriterException(Resources.Error_During_Connection, exception); + throw CreateStorageWriterException(databaseFilePath, Resources.Error_During_Connection, exception); } throw; } @@ -153,17 +152,17 @@ } catch (EntityNotFoundException e) { - throw CreateStorageWriterException(e.Message, e); + throw CreateStorageWriterException(databaseFilePath, e.Message, e); } catch (DataException exception) { - throw CreateStorageWriterException(Resources.Error_Update_Database, exception); + throw CreateStorageWriterException(databaseFilePath, Resources.Error_Update_Database, exception); } catch (SystemException exception) { if (exception is InvalidOperationException || exception is NotSupportedException) { - throw CreateStorageWriterException(Resources.Error_During_Connection, exception); + throw CreateStorageWriterException(databaseFilePath, Resources.Error_During_Connection, exception); } throw; } @@ -197,9 +196,9 @@ { projectEntity = dbContext.ProjectEntities.Single(); } - catch (InvalidOperationException) + catch (InvalidOperationException exception) { - throw CreateStorageReaderException(Resources.StorageSqLite_LoadProject_Invalid_Ringtoets_database_file); + throw CreateStorageReaderException(databaseFilePath, Resources.StorageSqLite_LoadProject_Invalid_Ringtoets_database_file, exception); } var project = projectEntity.Read(new ReadConversionCollector()); @@ -210,17 +209,16 @@ } catch (DataException exception) { - throw CreateStorageReaderException(string.Empty, exception); + throw CreateStorageReaderException(databaseFilePath, Resources.StorageSqLite_LoadProject_Invalid_Ringtoets_database_file, exception); } catch (SystemException exception) { - throw CreateStorageReaderException(string.Empty, exception); + throw CreateStorageReaderException(databaseFilePath, Resources.StorageSqLite_LoadProject_Invalid_Ringtoets_database_file, exception); } } public void CloseProject() { - filePath = null; connectionString = null; } @@ -289,24 +287,24 @@ private void SetConnectionToFile(string databaseFilePath) { - filePath = databaseFilePath; - if (!File.Exists(databaseFilePath)) { - throw CreateStorageReaderException(string.Empty, new CouldNotConnectException(UtilsResources.Error_File_does_not_exist)); + var message = new FileReaderErrorMessageBuilder(databaseFilePath).Build(UtilsResources.Error_File_does_not_exist); + throw new CouldNotConnectException(message); } - connectionString = SqLiteConnectionStringBuilder.BuildSqLiteEntityConnectionString(databaseFilePath); - - ValidateStorage(); + SetConnectionToStorage(databaseFilePath); } /// - /// Validates if the connected storage is a valid Ringtoets database. + /// Sets the connection to the Ringtoets database. /// - /// Thrown when the database does not contain the table version. - private void ValidateStorage() + /// The path of the file, which is used for creating exceptions. + /// Thrown when the database does not contain the table version. + private void SetConnectionToStorage(string databaseFilePath) { + connectionString = SqLiteConnectionStringBuilder.BuildSqLiteEntityConnectionString(databaseFilePath); + using (var dbContext = new RingtoetsEntities(connectionString)) { try @@ -316,7 +314,8 @@ } catch (Exception exception) { - throw CreateStorageReaderException(string.Empty, new StorageValidationException(string.Format(Resources.Error_Validating_Database_0, filePath), exception)); + var message = new FileReaderErrorMessageBuilder(databaseFilePath).Build(string.Format(Resources.StorageSqLite_LoadProject_Invalid_Ringtoets_database_file, databaseFilePath)); + throw new StorageValidationException(message, exception); } } } @@ -401,24 +400,26 @@ /// /// Throws a configured instance of when writing to the storage file failed. /// + /// The path of the file that was attempted to connect with. /// The critical error message. - /// Optional: exception that caused this exception to be thrown. + /// Exception that caused this exception to be thrown. /// Returns a new . - private StorageException CreateStorageWriterException(string errorMessage, Exception innerException = null) + private StorageException CreateStorageWriterException(string databaseFilePath, string errorMessage, Exception innerException) { - var message = new FileWriterErrorMessageBuilder(filePath).Build(errorMessage); + var message = new FileWriterErrorMessageBuilder(databaseFilePath).Build(errorMessage); return new StorageException(message, innerException); } /// /// Throws a configured instance of when reading the storage file failed. /// + /// The path of the file that was attempted to connect with. /// The critical error message. - /// Optional: exception that caused this exception to be thrown. + /// Exception that caused this exception to be thrown. /// Returns a new . - private StorageException CreateStorageReaderException(string errorMessage, Exception innerException = null) + private StorageException CreateStorageReaderException(string databaseFilePath, string errorMessage, Exception innerException) { - var message = new FileReaderErrorMessageBuilder(filePath).Build(errorMessage); + var message = new FileReaderErrorMessageBuilder(databaseFilePath).Build(errorMessage); return new StorageException(message, innerException); } } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputCreateExtensionsTest.cs =================================================================== diff -u -r01ff2c58c13df8f42661ae3e446dc2caaa94247e -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputCreateExtensionsTest.cs (.../GeneralGrassCoverErosionInwardsInputCreateExtensionsTest.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputCreateExtensionsTest.cs (.../GeneralGrassCoverErosionInwardsInputCreateExtensionsTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -28,10 +28,10 @@ } [Test] - public void Create_ValidGeneralInput_ReturnEntity( - [Random(0, 20, 1)]int n) + public void Create_ValidGeneralInput_ReturnEntity() { // Setup + var n = new Random(21).Next(0,20); var input = new GeneralGrassCoverErosionInwardsInput { N = n Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/DecimalConversionExtensionsTests.cs =================================================================== diff -u -r0046acb203ae12c74743abc12f57e557d96f9c5a -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/DecimalConversionExtensionsTests.cs (.../DecimalConversionExtensionsTests.cs) (revision 0046acb203ae12c74743abc12f57e557d96f9c5a) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/DecimalConversionExtensionsTests.cs (.../DecimalConversionExtensionsTests.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -42,8 +42,10 @@ } [Test] - public void ToNanableDouble_Number_ReturnNumberAsDouble( - [Random(-9999.9999, 9999.9999, 1)]double expectedValue) + [TestCase(-12312.352)] + [TestCase(234.125)] + [TestCase(0.0)] + public void ToNanableDouble_Number_ReturnNumberAsDouble(double expectedValue) { // Setup decimal? value = Convert.ToDecimal(expectedValue); @@ -69,8 +71,10 @@ } [Test] - public void ToNullableDouble_Number_ReturnNumberAsDouble( - [Random(-9999.9999, 9999.9999, 1)]double expectedValue) + [TestCase(-541561.121)] + [TestCase(21311.12)] + [TestCase(0.0)] + public void ToNullableDouble_Number_ReturnNumberAsDouble(double expectedValue) { // Setup decimal? value = Convert.ToDecimal(expectedValue); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/DoubleConversionExtensionsTest.cs =================================================================== diff -u -rc65d19779f30d0192ec94761faa85521f1070b53 -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/DoubleConversionExtensionsTest.cs (.../DoubleConversionExtensionsTest.cs) (revision c65d19779f30d0192ec94761faa85521f1070b53) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/DoubleConversionExtensionsTest.cs (.../DoubleConversionExtensionsTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -39,8 +39,10 @@ } [Test] - public void ToNullableDecimal_Number_ReturnThatNumberAsDecimal( - [Random(-9999.9999, 9999.9999, 1)] double value) + [TestCase(-154.516)] + [TestCase(9684.51)] + [TestCase(0.0)] + public void ToNullableDecimal_Number_ReturnThatNumberAsDecimal(double value) { // Call decimal? result = value.ToNullableDecimal(); @@ -85,8 +87,10 @@ } [Test] - public void ToNullableDecimal_NullableNumber_ReturnThatNumberAsDecimal( - [Random(-9999.9999, 9999.9999, 1)] double value) + [TestCase(-12312.352)] + [TestCase(51516.351)] + [TestCase(0.0)] + public void ToNullableDecimal_NullableNumber_ReturnThatNumberAsDecimal(double value) { // Call decimal? result = ((double?)value).ToNullableDecimal(); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs =================================================================== diff -u -r93f4c75ba2309bb82de7e2362bafca5aa516d545 -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 93f4c75ba2309bb82de7e2362bafca5aa516d545) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -182,7 +182,7 @@ var expectedMessages = new[] { "Openen van bestaand Ringtoetsproject.", - string.Format("Fout bij het lezen van bestand '{0}': ", testFile), + string.Format("Fout bij het lezen van bestand '{0}': Het bestand bestaat niet.", testFile), "Het is niet gelukt om het Ringtoetsproject te laden.", "Nieuw project aanmaken..." }; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs =================================================================== diff -u -ra5714fc0488030773fff50dfc82041c6cb9edc2f -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs) (revision a5714fc0488030773fff50dfc82041c6cb9edc2f) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -48,11 +48,13 @@ } [Test] - public void Read_ValidEntity_ReturnGeneralGrassCoverErosionInwardsInput( - [Random(1, 20, 1)]int n, - [Random(1, 56, 1)]int id) + public void Read_ValidEntity_ReturnGeneralGrassCoverErosionInwardsInput() { // Setup + var random = new Random(21); + var n = random.Next(1, 20); + var id = random.Next(1, 56); + var entity = new GrassCoverErosionInwardsFailureMechanismMetaEntity { GrassCoverErosionInwardsFailureMechanismMetaEntityId = id, Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/StorageSqLiteTest.cs =================================================================== diff -u -r7a542dea56b0bcfbbd4dd6f2c6abcafcfaa5f753 -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/StorageSqLiteTest.cs (.../StorageSqLiteTest.cs) (revision 7a542dea56b0bcfbbd4dd6f2c6abcafcfaa5f753) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/StorageSqLiteTest.cs (.../StorageSqLiteTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -75,19 +75,15 @@ { // Setup string nonExistingPath = "fileDoesNotExist"; - string expectedMessage = String.Format(@"Fout bij het lezen van bestand '{0}': ", nonExistingPath); - string expectedInnerMessage = "Het bestand bestaat niet."; + string expectedMessage = String.Format(@"Fout bij het lezen van bestand '{0}': {1}", nonExistingPath, "Het bestand bestaat niet."); // Call TestDelegate test = () => new StorageSqLite().LoadProject(nonExistingPath); // Assert - StorageException exception = Assert.Throws(test); + StorageException exception = Assert.Throws(test); - Assert.IsInstanceOf(exception); Assert.AreEqual(expectedMessage, exception.Message); - Assert.IsInstanceOf(exception.InnerException); - Assert.AreEqual(expectedInnerMessage, exception.InnerException.Message); } [Test] @@ -96,15 +92,14 @@ // Setup string validPath = "empty.rtd"; var tempFile = Path.Combine(testDataPath, validPath); - var expectedInnerMessage = String.Format(@"Het bestand '{0}' is geen geldig Ringtoets bestand.", tempFile); + string expectedMessage = String.Format(@"Fout bij het lezen van bestand '{0}': {1}", tempFile, @"Het bestand is geen geldig Ringtoets bestand."); // Call TestDelegate test = () => new StorageSqLite().LoadProject(tempFile); // Assert - StorageException exception = Assert.Throws(test); - Assert.IsInstanceOf(exception.InnerException); - Assert.AreEqual(expectedInnerMessage, exception.InnerException.Message); + StorageException exception = Assert.Throws(test); + Assert.AreEqual(expectedMessage, exception.Message); } [Test] @@ -138,7 +133,7 @@ public void LoadProject_CorruptRingtoetsFileThatPassesValidation_ThrowsStorageExceptionWithFullStackTrace() { // Setup - var expectedMessage = String.Format(@"Fout bij het lezen van bestand '{0}': ", tempRingtoetsFile); + string expectedMessage = String.Format(@"Fout bij het lezen van bestand '{0}': {1}", tempRingtoetsFile, @"Het bestand is geen geldig Ringtoets bestand."); var expectedInnerExceptionMessage = "An error occurred while executing the command definition. See the inner exception for details."; var expectedInnerExceptionInnerExceptionMessage = "SQL logic error or missing database" + Environment.NewLine + "no such table: ProjectEntity"; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputUpdateExtensionsTest.cs =================================================================== diff -u -ra5714fc0488030773fff50dfc82041c6cb9edc2f -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputUpdateExtensionsTest.cs (.../GeneralGrassCoverErosionInwardsInputUpdateExtensionsTest.cs) (revision a5714fc0488030773fff50dfc82041c6cb9edc2f) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputUpdateExtensionsTest.cs (.../GeneralGrassCoverErosionInwardsInputUpdateExtensionsTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -124,14 +124,14 @@ } [Test] - public void Update_ContextWithGrassCoverErosionInwardsFailureMechanismMetaEntity_PropertiesUpdated( - [Random(1, 20, 1)]int n) + public void Update_ContextWithGrassCoverErosionInwardsFailureMechanismMetaEntity_PropertiesUpdated() { // Setup MockRepository mocks = new MockRepository(); var ringtoetsEntities = RingtoetsEntitiesHelper.CreateStub(mocks); mocks.ReplayAll(); + var n = new Random(21).Next(1,20); const int storageId = 1; var input = new GeneralGrassCoverErosionInwardsInput { Index: Core/Common/src/Core.Common.Base/Storage/CouldNotConnectException.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Core/Common/src/Core.Common.Base/Storage/CouldNotConnectException.cs (.../CouldNotConnectException.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Core/Common/src/Core.Common.Base/Storage/CouldNotConnectException.cs (.../CouldNotConnectException.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -26,7 +26,7 @@ /// /// The exception that is thrown when a class is unable to connect. /// - public class CouldNotConnectException : Exception + public class CouldNotConnectException : StorageException { /// /// Initializes a new instance of the class. Index: Core/Common/src/Core.Common.Base/Storage/StorageValidationException.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Core/Common/src/Core.Common.Base/Storage/StorageValidationException.cs (.../StorageValidationException.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Core/Common/src/Core.Common.Base/Storage/StorageValidationException.cs (.../StorageValidationException.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -26,7 +26,7 @@ /// /// The exception that is thrown when a storage is not valid. /// - public class StorageValidationException : Exception + public class StorageValidationException : StorageException { /// /// Initializes a new instance of the class. Index: Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs =================================================================== diff -u -rb78b6d08e4be8dfe938718d5e65085aa8bd72dcc -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs (.../StorageCommandHandler.cs) (revision b78b6d08e4be8dfe938718d5e65085aa8bd72dcc) +++ Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs (.../StorageCommandHandler.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -150,7 +150,7 @@ return false; } - if (!TrySaveProjectAs(projectPersistor, filePath)) + if (!TrySaveProjectAs(filePath)) { return false; } @@ -178,7 +178,7 @@ return SaveProjectAs(); } - if (!TrySaveProject(projectPersistor, filePath)) + if (!TrySaveProject(filePath)) { return false; } @@ -258,11 +258,11 @@ } } - private bool TrySaveProjectAs(IStoreProject storage, string filePath) + private bool TrySaveProjectAs(string filePath) { try { - storage.SaveProjectAs(filePath, projectOwner.Project); + projectPersistor.SaveProjectAs(filePath, projectOwner.Project); return true; } catch (StorageException e) @@ -273,11 +273,11 @@ } } - private bool TrySaveProject(IStoreProject storage, string filePath) + private bool TrySaveProject(string filePath) { try { - storage.SaveProject(filePath, projectOwner.Project); + projectPersistor.SaveProject(filePath, projectOwner.Project); return true; } catch (StorageException e) Index: Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs =================================================================== diff -u -r151bab16a7ebc1bffc0621ab56c6dc219db1e90f -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs (.../Math2DTest.cs) (revision 151bab16a7ebc1bffc0621ab56c6dc219db1e90f) +++ Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs (.../Math2DTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -841,9 +841,12 @@ } [Test] - public void GetIntersectionBetweenSegments_SegmentsArePointsOnTopOfEachOther_ReturnIntersection( - [Random(-9876.54321, 1234.56789, 1)]double x, - [Random(-123456.789, 98765.4321, 1)]double y) + [TestCase(0,0)] + [TestCase(-6541.2354,5.25)] + [TestCase(-3.25,-12.55)] + [TestCase(6.154,-9684.514)] + [TestCase(6840.251,15.3251)] + public void GetIntersectionBetweenSegments_SegmentsArePointsOnTopOfEachOther_ReturnIntersection(double x, double y) { // Setup var segment1 = new Segment2D(new Point2D(x, y), new Point2D(x, y)); Index: Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs =================================================================== diff -u -r151bab16a7ebc1bffc0621ab56c6dc219db1e90f -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs (.../Point2DTest.cs) (revision 151bab16a7ebc1bffc0621ab56c6dc219db1e90f) +++ Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs (.../Point2DTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -175,9 +175,12 @@ } [Test] - public void AddOperator_PointWithZeroVector_ReturnEqualPoint( - [Random(-12345.6789, 9876.54321, 1)]double x, - [Random(-12345.6789, 9876.54321, 1)]double y) + [TestCase(0, 0)] + [TestCase(-6541.2354, 5.25)] + [TestCase(-3.25, -12.55)] + [TestCase(6.154, -9684.514)] + [TestCase(6840.251, 15.3251)] + public void AddOperator_PointWithZeroVector_ReturnEqualPoint(double x, double y) { // Setup var originalPoint = new Point2D(x, y); @@ -193,9 +196,12 @@ } [Test] - public void AddOperator_PointWithVector_ReturnEqualPoint( - [Random(-12345.6789, 98765.4321, 1)]double x, - [Random(-12345.6789, 98765.4321, 1)]double y) + [TestCase(0, 0)] + [TestCase(-6541.2354, 5.25)] + [TestCase(-3.25, -12.55)] + [TestCase(6.154, -9684.514)] + [TestCase(6840.251, 15.3251)] + public void AddOperator_PointWithVector_ReturnEqualPoint(double x, double y) { // Setup var originalPoint = new Point2D(x, y); Index: Core/Common/test/Core.Common.Base.Test/Storage/CouldNotConnectExceptionTest.cs =================================================================== diff -u -r151bab16a7ebc1bffc0621ab56c6dc219db1e90f -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Core/Common/test/Core.Common.Base.Test/Storage/CouldNotConnectExceptionTest.cs (.../CouldNotConnectExceptionTest.cs) (revision 151bab16a7ebc1bffc0621ab56c6dc219db1e90f) +++ Core/Common/test/Core.Common.Base.Test/Storage/CouldNotConnectExceptionTest.cs (.../CouldNotConnectExceptionTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -38,7 +38,7 @@ CouldNotConnectException exception = new CouldNotConnectException(); // Assert - Assert.IsInstanceOf(exception); + Assert.IsInstanceOf(exception); Assert.IsNull(exception.InnerException); Assert.AreEqual(expectedMessage, exception.Message); } Index: Core/Common/test/Core.Common.Base.Test/Storage/StorageValidationExceptionTest.cs =================================================================== diff -u -r151bab16a7ebc1bffc0621ab56c6dc219db1e90f -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Core/Common/test/Core.Common.Base.Test/Storage/StorageValidationExceptionTest.cs (.../StorageValidationExceptionTest.cs) (revision 151bab16a7ebc1bffc0621ab56c6dc219db1e90f) +++ Core/Common/test/Core.Common.Base.Test/Storage/StorageValidationExceptionTest.cs (.../StorageValidationExceptionTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -38,7 +38,7 @@ StorageValidationException exception = new StorageValidationException(); // Assert - Assert.IsInstanceOf(exception); + Assert.IsInstanceOf(exception); Assert.IsNull(exception.InnerException); Assert.AreEqual(expectedMessage, exception.Message); } Index: Core/Common/test/Core.Common.Gui.Test/Attributes/PropertyOrderAttributeTest.cs =================================================================== diff -u -r151bab16a7ebc1bffc0621ab56c6dc219db1e90f -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Core/Common/test/Core.Common.Gui.Test/Attributes/PropertyOrderAttributeTest.cs (.../PropertyOrderAttributeTest.cs) (revision 151bab16a7ebc1bffc0621ab56c6dc219db1e90f) +++ Core/Common/test/Core.Common.Gui.Test/Attributes/PropertyOrderAttributeTest.cs (.../PropertyOrderAttributeTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -31,8 +31,11 @@ public class PropertyOrderAttributeTest { [Test] - public void ParameteredConstructor_ExpectedValues([Random(int.MinValue, int.MaxValue, 1)] int order) + public void ParameteredConstructor_ExpectedValues() { + // Setup + var order = new Random(21).Next(int.MinValue, int.MaxValue); + // Call var attribute = new PropertyOrderAttribute(order); Index: Core/Common/test/Core.Common.Gui.Test/Converters/ExpandableArrayConverterTest.cs =================================================================== diff -u -r0ebf7ee0c2ee3cefb8f3d0eed09e702780e85c4b -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Core/Common/test/Core.Common.Gui.Test/Converters/ExpandableArrayConverterTest.cs (.../ExpandableArrayConverterTest.cs) (revision 0ebf7ee0c2ee3cefb8f3d0eed09e702780e85c4b) +++ Core/Common/test/Core.Common.Gui.Test/Converters/ExpandableArrayConverterTest.cs (.../ExpandableArrayConverterTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -43,9 +43,11 @@ } [Test] - public void ConvertTo_FromArrayToString_ReturnCountText([Random(0, 10, 1)]int arrayCount) + public void ConvertTo_FromArrayToString_ReturnCountText() { // Setup + var arrayCount = new Random(21).Next(0, 10); + var sourceArray = new int[arrayCount]; var converter = new ExpandableArrayConverter(); Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/DikeProfiles/DikeProfileDataTest.cs =================================================================== diff -u -r08bb42496e8a53fadae26340ea3d51939c846679 -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/DikeProfiles/DikeProfileDataTest.cs (.../DikeProfileDataTest.cs) (revision 08bb42496e8a53fadae26340ea3d51939c846679) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/DikeProfiles/DikeProfileDataTest.cs (.../DikeProfileDataTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) @@ -68,9 +68,10 @@ } [Test] - public void Orientation_SetNewValue_GetNewlySetValue([Random(0, 360.0, 1)]double newValue) + public void Orientation_SetNewValue_GetNewlySetValue() { // Setup + var newValue = new Random(21).NextDouble() * 360; var dikeProfileData = new DikeProfileData(); // Call @@ -81,9 +82,10 @@ } [Test] - public void DamType_SetNewValue_GetsNewlySetValue([Random(0, 3, 1)]int index) + public void DamType_SetNewValue_GetsNewlySetValue() { // Setup + var index = new Random(21).Next(0, 3); var dikeProfileData = new DikeProfileData(); DamType newValue = Enum.GetValues(typeof(DamType)).OfType().ElementAt(index); @@ -96,9 +98,10 @@ } [Test] - public void DamHeight_SetNewValue_GetNewlySetValue([Random(-999.999, 999.999, 1)]double newValue) + public void DamHeight_SetNewValue_GetNewlySetValue() { // Setup + var newValue = new Random(21).NextDouble(); var dikeProfileData = new DikeProfileData(); // Call @@ -109,9 +112,10 @@ } [Test] - public void DikeHeight_SetNewValue_GetNewlySetValue([Random(-999.999, 999.999, 1)]double newValue) + public void DikeHeight_SetNewValue_GetNewlySetValue() { // Setup + var newValue = new Random(21).NextDouble(); var dikeProfileData = new DikeProfileData(); // Call @@ -122,9 +126,10 @@ } [Test] - public void SheetPilingType_SetNewValue_GetsNewlySetValue([Random(0, 3, 1)]int index) + public void SheetPilingType_SetNewValue_GetsNewlySetValue() { // Setup + var index = new Random(21).Next(0,3); var dikeProfileData = new DikeProfileData(); SheetPileType newValue = Enum.GetValues(typeof(SheetPileType)).OfType().ElementAt(index);