Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/DatabaseStructure17.2.sql =================================================================== diff -u -r54242411470f330f6f4c75d1d05bfd0911706873 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/DatabaseStructure17.2.sql (.../DatabaseStructure17.2.sql) (revision 54242411470f330f6f4c75d1d05bfd0911706873) +++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/DatabaseStructure17.2.sql (.../DatabaseStructure17.2.sql) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -1,6 +1,6 @@ /* ---------------------------------------------------- */ /* Generated by Enterprise Architect Version 12.0 */ -/* Created On : 30-Jun-2017 15:41:39 */ +/* Created On : 03-Jul-2017 13:29:29 */ /* DBMS : SQLite */ /* ---------------------------------------------------- */ @@ -219,10 +219,10 @@ DROP TABLE IF EXISTS 'GrassCoverErosionInwardsOvertoppingRateOutputEntity' ; -DROP TABLE IF EXISTS 'GeneralResultSubmechanismIllustrationPointEntity' +DROP TABLE IF EXISTS 'GeneralResultSubMechanismIllustrationPointEntity' ; -DROP TABLE IF EXISTS 'SubmechanismIllustrationPointEntity' +DROP TABLE IF EXISTS 'SubMechanismIllustrationPointEntity' ; DROP TABLE IF EXISTS 'IllustrationPointResultEntity' @@ -231,13 +231,13 @@ DROP TABLE IF EXISTS 'StochastEntity' ; -DROP TABLE IF EXISTS 'GeneralResultSubmechanismIllustrationPointStochastEntity' +DROP TABLE IF EXISTS 'GeneralResultSubMechanismIllustrationPointStochastEntity' ; -DROP TABLE IF EXISTS 'TopLevelSubmechanismIllustrationPointEntity' +DROP TABLE IF EXISTS 'TopLevelSubMechanismIllustrationPointEntity' ; -DROP TABLE IF EXISTS 'SubmechanismIllustrationPointStochastEntity' +DROP TABLE IF EXISTS 'SubMechanismIllustrationPointStochastEntity' ; /* Create Tables with Primary and Foreign Keys, Check and Unique Constraints */ @@ -1344,15 +1344,15 @@ ( 'HydraulicLocationEntityOutputId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'HydraulicLocationEntityId' INTEGER NOT NULL, - 'GeneralResultSubmechanismIllustrationPointEntityId' INTEGER, + 'GeneralResultSubMechanismIllustrationPointEntityId' INTEGER, 'HydraulicLocationOutputType' TINYINT (1) NOT NULL, -- Enum: 1 = DesignWaterLevel, 2 = WaveHeight 'Result' REAL, 'TargetProbability' REAL, 'TargetReliability' REAL, 'CalculatedProbability' REAL, 'CalculatedReliability' REAL, 'CalculationConvergence' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = CalculatedNotConverged, 3 = CalculatedConverged - CONSTRAINT 'FK_HydraulicLocationOutputEntity_GeneralResultSubMechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubmechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubmechanismIllustrationPointEntity' ('GeneralResultSubmechanismIllustrationPointEntityId') ON DELETE No Action ON UPDATE No Action, + CONSTRAINT 'FK_HydraulicLocationOutputEntity_GeneralResultSubMechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubMechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubMechanismIllustrationPointEntity' ('GeneralResultSubMechanismIllustrationPointEntityId') ON DELETE No Action ON UPDATE No Action, CONSTRAINT 'FK_HydraulicLocationOutputEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') ON DELETE Cascade ON UPDATE Cascade, CONSTRAINT 'U_HydraulicLocationEntityOutputType' UNIQUE ('HydraulicLocationEntityId','HydraulicLocationOutputType') ) @@ -1362,15 +1362,15 @@ ( 'GrassCoverErosionOutwardsHydraulicLocationOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'GrassCoverErosionOutwardsHydraulicLocationEntityId' INTEGER NOT NULL, - 'GeneralResultSubmechanismIllustrationPointEntityId' INTEGER, + 'GeneralResultSubMechanismIllustrationPointEntityId' INTEGER, 'HydraulicLocationOutputType' TINYINT (1) NOT NULL, -- Enum: 1 = DesignWaterLevel, 2 = WaveHeight 'Result' REAL, 'TargetProbability' REAL, 'TargetReliability' REAL, 'CalculatedProbability' REAL, 'CalculatedReliability' REAL, 'CalculationConvergence' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = CalculatedNotConverged, 3 = CalculatedConverged - CONSTRAINT 'FK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GeneralResultSubMechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubmechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubmechanismIllustrationPointEntity' ('GeneralResultSubmechanismIllustrationPointEntityId') ON DELETE No Action ON UPDATE No Action, + CONSTRAINT 'FK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GeneralResultSubMechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubMechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubMechanismIllustrationPointEntity' ('GeneralResultSubMechanismIllustrationPointEntityId') ON DELETE No Action ON UPDATE No Action, CONSTRAINT 'FK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GrassCoverErosionOutwardsHydraulicLocationEntity' FOREIGN KEY ('GrassCoverErosionOutwardsHydraulicLocationEntityId') REFERENCES 'GrassCoverErosionOutwardsHydraulicLocationEntity' ('GrassCoverErosionOutwardsHydraulicLocationEntityId') ON DELETE Cascade ON UPDATE Cascade, CONSTRAINT 'U_HydraulicLocationOutputType' UNIQUE ('GrassCoverErosionOutwardsHydraulicLocationEntityId','HydraulicLocationOutputType') ) @@ -1447,17 +1447,17 @@ ) ; -CREATE TABLE 'GeneralResultSubmechanismIllustrationPointEntity' +CREATE TABLE 'GeneralResultSubMechanismIllustrationPointEntity' ( - 'GeneralResultSubmechanismIllustrationPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + 'GeneralResultSubMechanismIllustrationPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'GoverningWindDirectionName' TEXT NOT NULL, 'GoverningWindDirectionAngle' REAL NOT NULL ) ; -CREATE TABLE 'SubmechanismIllustrationPointEntity' +CREATE TABLE 'SubMechanismIllustrationPointEntity' ( - 'SubmechanismIllustrationPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + 'SubMechanismIllustrationPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'Name' TEXT NOT NULL, 'Beta' REAL NOT NULL, 'Order' INT (4) NOT NULL @@ -1467,11 +1467,11 @@ CREATE TABLE 'IllustrationPointResultEntity' ( 'IllustrationPointResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - 'SubmechanismIllustrationPointEntityId' INTEGER NOT NULL, + 'SubMechanismIllustrationPointEntityId' INTEGER NOT NULL, 'Description' TEXT NOT NULL, 'Value' REAL NOT NULL, 'Order' INT (4) NOT NULL, - CONSTRAINT 'FK_IllustrationPointResultEntity_SubmechanismIllustrationPointEntity' FOREIGN KEY ('SubmechanismIllustrationPointEntityId') REFERENCES 'SubmechanismIllustrationPointEntity' ('SubmechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade + CONSTRAINT 'FK_IllustrationPointResultEntity_SubMechanismIllustrationPointEntity' FOREIGN KEY ('SubMechanismIllustrationPointEntityId') REFERENCES 'SubMechanismIllustrationPointEntity' ('SubMechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade ) ; @@ -1485,41 +1485,41 @@ ) ; -CREATE TABLE 'GeneralResultSubmechanismIllustrationPointStochastEntity' +CREATE TABLE 'GeneralResultSubMechanismIllustrationPointStochastEntity' ( - 'GeneralResultSubmechanismIllustrationPointEntityId' INTEGER NOT NULL, + 'GeneralResultSubMechanismIllustrationPointEntityId' INTEGER NOT NULL, 'StochastEntityId' INTEGER NOT NULL, - CONSTRAINT 'PK_GeneralResultSubmechanismIllustrationPointStochastEntity' PRIMARY KEY ('GeneralResultSubmechanismIllustrationPointEntityId','StochastEntityId'), - CONSTRAINT 'FK_GeneralResultSubmechanisIllustrationPointStochastEntity_GeneralResultSubmechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubmechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubmechanismIllustrationPointEntity' ('GeneralResultSubmechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade, - CONSTRAINT 'FK_GeneralResultSubmechanismIllustrationPointStochastEntity_StochastEntity' FOREIGN KEY ('StochastEntityId') REFERENCES 'StochastEntity' ('StochastEntityId') ON DELETE No Action ON UPDATE No Action + CONSTRAINT 'PK_GeneralResultSubMechanismIllustrationPointStochastEntity' PRIMARY KEY ('GeneralResultSubMechanismIllustrationPointEntityId','StochastEntityId'), + CONSTRAINT 'FK_GeneralResultSubMechanisIllustrationPointStochastEntity_GeneralResultSubMechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubMechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubMechanismIllustrationPointEntity' ('GeneralResultSubMechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade, + CONSTRAINT 'FK_GeneralResultSubMechanismIllustrationPointStochastEntity_StochastEntity' FOREIGN KEY ('StochastEntityId') REFERENCES 'StochastEntity' ('StochastEntityId') ON DELETE No Action ON UPDATE No Action ) ; -CREATE TABLE 'TopLevelSubmechanismIllustrationPointEntity' +CREATE TABLE 'TopLevelSubMechanismIllustrationPointEntity' ( - 'TopLevelSubmechanismIllustrationPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - 'GeneralResultSubmechanismIllustrationPointEntityId' INTEGER NOT NULL, - 'SubmechanismIllustrationPointEntityId' INTEGER NOT NULL, + 'TopLevelSubMechanismIllustrationPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + 'GeneralResultSubMechanismIllustrationPointEntityId' INTEGER NOT NULL, + 'SubMechanismIllustrationPointEntityId' INTEGER NOT NULL, 'ClosingSituation' TEXT NOT NULL, 'WindDirectionName' TEXT NOT NULL, 'WindDirectionAngle' REAL NOT NULL, 'Beta' REAL NOT NULL, 'Order' INT (4) NOT NULL, - CONSTRAINT 'FK_TopLevelSubmechanismIllustrationPointEntity_GeneralResultSubmechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubmechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubmechanismIllustrationPointEntity' ('GeneralResultSubmechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade, - CONSTRAINT 'FK_TopLevelSubmechanismIllustrationPointEntity_SubmechanismIllustrationPointEntity' FOREIGN KEY ('SubmechanismIllustrationPointEntityId') REFERENCES 'SubmechanismIllustrationPointEntity' ('SubmechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade + CONSTRAINT 'FK_TopLevelSubMechanismIllustrationPointEntity_GeneralResultSubMechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubMechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubMechanismIllustrationPointEntity' ('GeneralResultSubMechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade, + CONSTRAINT 'FK_TopLevelSubMechanismIllustrationPointEntity_SubMechanismIllustrationPointEntity' FOREIGN KEY ('SubMechanismIllustrationPointEntityId') REFERENCES 'SubMechanismIllustrationPointEntity' ('SubMechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade ) ; -CREATE TABLE 'SubmechanismIllustrationPointStochastEntity' +CREATE TABLE 'SubMechanismIllustrationPointStochastEntity' ( - 'SubmechanismIllustrationPointStochastEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - 'SubmechanismIllustrationPointEntityId' INTEGER NOT NULL, + 'SubMechanismIllustrationPointStochastEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + 'SubMechanismIllustrationPointEntityId' INTEGER NOT NULL, 'Name' TEXT NOT NULL, 'Duration' REAL NOT NULL, 'Alpha' REAL NOT NULL, 'Realization' REAL NOT NULL, 'Order' INT (4) NOT NULL, - CONSTRAINT 'FK_SubmechanismIllustrationPointStochast_SubmechanismIllustrationPointEntity' FOREIGN KEY ('SubmechanismIllustrationPointEntityId') REFERENCES 'SubmechanismIllustrationPointEntity' ('SubmechanismIllustrationPointEntityId') ON DELETE No Action ON UPDATE No Action + CONSTRAINT 'FK_SubMechanismIllustrationPointStochast_SubMechanismIllustrationPointEntity' FOREIGN KEY ('SubMechanismIllustrationPointEntityId') REFERENCES 'SubMechanismIllustrationPointEntity' ('SubMechanismIllustrationPointEntityId') ON DELETE No Action ON UPDATE No Action ) ; @@ -1870,38 +1870,38 @@ ; CREATE INDEX 'IXFK_HydraulicLocationOutputEntity_GeneralResultSubMechanismIllustrationPointEntity' - ON 'HydraulicLocationOutputEntity' ('GeneralResultSubmechanismIllustrationPointEntityId' ASC) + ON 'HydraulicLocationOutputEntity' ('GeneralResultSubMechanismIllustrationPointEntityId' ASC) ; CREATE INDEX 'IXFK_HydraulicLocationOutputEntity_HydraulicLocationEntity' ON 'HydraulicLocationOutputEntity' ('HydraulicLocationEntityId' ASC) ; -CREATE TRIGGER [TR_AfterDeleteHydraulicLocationOutputEntity_RemoveGeneralResultSubmechanismIllustrationPointEntity] +CREATE TRIGGER [TR_AfterDeleteHydraulicLocationOutputEntity_RemoveGeneralResultSubMechanismIllustrationPointEntity] AFTER DELETE ON HydraulicLocationOutputEntity FOR EACH ROW BEGIN - DELETE FROM GeneralResultSubmechanismIllustrationPointEntity - WHERE OLD.GeneralResultSubmechanismIllustrationPointEntityId IS NOT NULL AND - GeneralResultSubmechanismIllustrationPointEntityId IS OLD.GeneralResultSubmechanismIllustrationPointEntityId; + DELETE FROM GeneralResultSubMechanismIllustrationPointEntity + WHERE OLD.GeneralResultSubMechanismIllustrationPointEntityId IS NOT NULL AND + GeneralResultSubMechanismIllustrationPointEntityId IS OLD.GeneralResultSubMechanismIllustrationPointEntityId; END; ; CREATE INDEX 'IXFK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GeneralResultSubMechanismIllustrationPointEntity' - ON 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity' ('GeneralResultSubmechanismIllustrationPointEntityId' ASC) + ON 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity' ('GeneralResultSubMechanismIllustrationPointEntityId' ASC) ; CREATE INDEX 'IXFK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GrassCoverErosionOutwardsHydraulicLocationEntity' ON 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity' ('GrassCoverErosionOutwardsHydraulicLocationEntityId' ASC) ; -CREATE TRIGGER [TR_AfterDeleteGrassCoverErosionOuwardsHydraulicLocationOutputEntity_RemoveGeneralResultSubmechanismIllustrationPointEntity] +CREATE TRIGGER [TR_AfterDeleteGrassCoverErosionOuwardsHydraulicLocationOutputEntity_RemoveGeneralResultSubMechanismIllustrationPointEntity] AFTER DELETE ON GrassCoverErosionOutwardsHydraulicLocationOutputEntity FOR EACH ROW BEGIN - DELETE FROM GrassCoverErosionOutwardsHydraulicLocationOutputEntity - WHERE OLD.GrassCoverErosionOutwardsHydraulicLocationOutputEntityId IS NOT NULL AND - GrassCoverErosionOutwardsHydraulicLocationOutputEntityId IS OLD.GrassCoverErosionOutwardsHydraulicLocationOutputEntityId; + DELETE FROM GeneralResultSubMechanismIllustrationPointEntity + WHERE OLD.GeneralResultSubMechanismIllustrationPointEntityId IS NOT NULL AND + GeneralResultSubMechanismIllustrationPointEntityId IS OLD.GeneralResultSubMechanismIllustrationPointEntityId; END; ; @@ -1925,20 +1925,20 @@ ON 'GrassCoverErosionInwardsOvertoppingRateOutputEntity' ('GrassCoverErosionInwardsOutputEntityId' ASC) ; -CREATE INDEX 'IXFK_IllustrationPointResultEntity_SubmechanismIllustrationPointEntity' - ON 'IllustrationPointResultEntity' ('SubmechanismIllustrationPointEntityId' ASC) +CREATE INDEX 'IXFK_IllustrationPointResultEntity_SubMechanismIllustrationPointEntity' + ON 'IllustrationPointResultEntity' ('SubMechanismIllustrationPointEntityId' ASC) ; -CREATE INDEX 'IXFK_GeneralResultSubmechanismIllustrationPointStochastEntity_GeneralResultSubmechanismIllustrationPointEntity' - ON 'GeneralResultSubmechanismIllustrationPointStochastEntity' ('GeneralResultSubmechanismIllustrationPointEntityId' ASC) +CREATE INDEX 'IXFK_GeneralResultSubMechanismIllustrationPointStochastEntity_GeneralResultSubMechanismIllustrationPointEntity' + ON 'GeneralResultSubMechanismIllustrationPointStochastEntity' ('GeneralResultSubMechanismIllustrationPointEntityId' ASC) ; -CREATE INDEX 'IXFK_GeneralResultSubmechanismIllustrationPointStochastEntity_StochastEntity' - ON 'GeneralResultSubmechanismIllustrationPointStochastEntity' ('StochastEntityId' ASC) +CREATE INDEX 'IXFK_GeneralResultSubMechanismIllustrationPointStochastEntity_StochastEntity' + ON 'GeneralResultSubMechanismIllustrationPointStochastEntity' ('StochastEntityId' ASC) ; -CREATE TRIGGER [TR_AfterDeleteGeneralResultSubmechanismIllustrationPointStochastEntity_RemoveStochastEntity] +CREATE TRIGGER [TR_AfterDeleteGeneralResultSubMechanismIllustrationPointStochastEntity_RemoveStochastEntity] AFTER DELETE - ON GeneralResultSubmechanismIllustrationPointStochastEntity + ON GeneralResultSubMechanismIllustrationPointStochastEntity FOR EACH ROW BEGIN DELETE FROM StochastEntity @@ -1947,24 +1947,24 @@ END; ; -CREATE INDEX 'IXFK_TopLevelSubmechanismIllustrationPointEntity_GeneralResultSubmechanismIllustrationPointEntity' - ON 'TopLevelSubmechanismIllustrationPointEntity' ('GeneralResultSubmechanismIllustrationPointEntityId' ASC) +CREATE INDEX 'IXFK_TopLevelSubMechanismIllustrationPointEntity_GeneralResultSubMechanismIllustrationPointEntity' + ON 'TopLevelSubMechanismIllustrationPointEntity' ('GeneralResultSubMechanismIllustrationPointEntityId' ASC) ; -CREATE INDEX 'IXFK_TopLevelSubmechanismIllustrationPointEntity_SubmechanismIllustrationPointEntity' - ON 'TopLevelSubmechanismIllustrationPointEntity' ('SubmechanismIllustrationPointEntityId' ASC) +CREATE INDEX 'IXFK_TopLevelSubMechanismIllustrationPointEntity_SubMechanismIllustrationPointEntity' + ON 'TopLevelSubMechanismIllustrationPointEntity' ('SubMechanismIllustrationPointEntityId' ASC) ; -CREATE TRIGGER [TR_AfterDeleteTopLevelSubmechanismIllustrationPointEntity_RemoveSubmechanismIllustrationPointEntity] +CREATE TRIGGER [TR_AfterDeleteTopLevelSubMechanismIllustrationPointEntity_RemoveSubMechanismIllustrationPointEntity] AFTER DELETE - ON TopLevelSubmechanismIllustrationPointEntity + ON TopLevelSubMechanismIllustrationPointEntity FOR EACH ROW BEGIN - DELETE FROM SubmechanismIllustrationPointEntity - WHERE OLD.SubmechanismIllustrationPointEntityId IS NOT NULL AND - SubmechanismIllustrationPointEntityId IS OLD.SubmechanismIllustrationPointEntityId; + DELETE FROM SubMechanismIllustrationPointEntity + WHERE OLD.SubMechanismIllustrationPointEntityId IS NOT NULL AND + SubMechanismIllustrationPointEntityId IS OLD.SubMechanismIllustrationPointEntityId; END; ; -CREATE INDEX 'IXFK_SubmechanismIllustrationPointStochast_SubmechanismIllustrationPointEntity' - ON 'SubmechanismIllustrationPointStochastEntity' ('SubmechanismIllustrationPointEntityId' ASC) +CREATE INDEX 'IXFK_SubMechanismIllustrationPointStochast_SubMechanismIllustrationPointEntity' + ON 'SubMechanismIllustrationPointStochastEntity' ('SubMechanismIllustrationPointEntityId' ASC) ; Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql =================================================================== diff -u -r54242411470f330f6f4c75d1d05bfd0911706873 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql (.../Migration_17.1_17.2.sql) (revision 54242411470f330f6f4c75d1d05bfd0911706873) +++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql (.../Migration_17.1_17.2.sql) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -189,7 +189,7 @@ INSERT INTO GrassCoverErosionOutwardsHydraulicLocationOutputEntity( [GrassCoverErosionOutwardsHydraulicLocationOutputEntityId], [GrassCoverErosionOutwardsHydraulicLocationEntityId], - [GeneralResultSubmechanismIllustrationPointEntityId], + [GeneralResultSubMechanismIllustrationPointEntityId], [HydraulicLocationOutputType], [Result], [TargetProbability], @@ -310,7 +310,7 @@ INSERT INTO HydraulicLocationOutputEntity( [HydraulicLocationEntityOutputId], [HydraulicLocationEntityId], - [GeneralResultSubmechanismIllustrationPointEntityId], + [GeneralResultSubMechanismIllustrationPointEntityId], [HydraulicLocationOutputType], [Result], [TargetProbability], Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -r548ebfbd35f147dc64cb0d566fe8f30ec2a0e434 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 548ebfbd35f147dc64cb0d566fe8f30ec2a0e434) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -73,8 +73,8 @@ - - + + Code @@ -139,7 +139,7 @@ RingtoetsEntities.tt - + RingtoetsEntities.tt @@ -295,10 +295,10 @@ RingtoetsEntities.tt - + RingtoetsEntities.tt - + RingtoetsEntities.tt @@ -307,7 +307,7 @@ RingtoetsEntities.tt - + RingtoetsEntities.tt @@ -350,8 +350,8 @@ - - + + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/SubMechanismIllustrationPointCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/SubMechanismIllustrationPointCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/SubMechanismIllustrationPointCreateExtensions.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,86 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using Application.Ringtoets.Storage.DbContext; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; + +namespace Application.Ringtoets.Storage.Create.IllustrationPoints +{ + /// + /// Extension methods for + /// related to creating an instance of . + /// + internal static class SubMechanismIllustrationPointCreateExtensions + { + /// + /// Creates a based on + /// the information of . + /// + /// The submechanism illustration + /// point to create a database entity for. + /// A new . + /// Thrown when + /// is null. + public static SubMechanismIllustrationPointEntity CreateSubMechanismIllustrationPointEntity( + this SubMechanismIllustrationPoint subMechanismIllustrationPoint) + { + if (subMechanismIllustrationPoint == null) + { + throw new ArgumentNullException(nameof(subMechanismIllustrationPoint)); + } + + var entity = new SubMechanismIllustrationPointEntity + { + Beta = subMechanismIllustrationPoint.Beta, + Name = subMechanismIllustrationPoint.Name + }; + + AddEntitiesForSubMechanismIllustrationPoints(subMechanismIllustrationPoint.Stochasts, entity); + AddEntitiesForIllustrationPointResults(subMechanismIllustrationPoint.IllustrationPointResults, entity); + + return entity; + } + + private static void AddEntitiesForIllustrationPointResults(IEnumerable illustrationPointResults, + SubMechanismIllustrationPointEntity entity) + { + var order = 0; + foreach (IllustrationPointResult illustrationPointResult in illustrationPointResults) + { + entity.IllustrationPointResultEntities.Add( + illustrationPointResult.CreateIllustrationPointResultEntity(order++)); + } + } + + private static void AddEntitiesForSubMechanismIllustrationPoints(IEnumerable stochasts, + SubMechanismIllustrationPointEntity entity) + { + var order = 0; + foreach (SubMechanismIllustrationPointStochast subMechanismIllustrationPointStochast in stochasts) + { + entity.SubMechanismIllustrationPointStochastEntities.Add( + subMechanismIllustrationPointStochast.CreateSubMechanismIllustrationPointStochastEntity(order++)); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/SubMechanismIllustrationPointStochastCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/SubMechanismIllustrationPointStochastCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/SubMechanismIllustrationPointStochastCreateExtensions.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,64 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Application.Ringtoets.Storage.DbContext; +using Core.Common.Utils.Extensions; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; + +namespace Application.Ringtoets.Storage.Create.IllustrationPoints +{ + /// + /// Extension methods for related to creating an instance of + /// . + /// + internal static class SubMechanismIllustrationPointStochastCreateExtensions + { + /// + /// Creates a based on the information + /// of the . + /// + /// The stochast to create a database entity for. + /// The index at which resides within its parent. + /// A new . + /// Thrown when + /// is null. + public static SubMechanismIllustrationPointStochastEntity CreateSubMechanismIllustrationPointStochastEntity( + this SubMechanismIllustrationPointStochast subMechanismIllustrationPointStochast, int order) + { + if (subMechanismIllustrationPointStochast == null) + { + throw new ArgumentNullException(nameof(subMechanismIllustrationPointStochast)); + } + + var entity = new SubMechanismIllustrationPointStochastEntity + { + Name = subMechanismIllustrationPointStochast.Name.DeepClone(), + Alpha = subMechanismIllustrationPointStochast.Alpha, + Duration = subMechanismIllustrationPointStochast.Duration, + Realization = subMechanismIllustrationPointStochast.Realization, + Order = order + }; + + return entity; + } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/SubmechanismIllustrationPointCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/IllustrationPoints/SubmechanismIllustrationPointStochastCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GeneralResultSubMechanismIllustrationPointEntity.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GeneralResultSubMechanismIllustrationPointEntity.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GeneralResultSubMechanismIllustrationPointEntity.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,63 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; + +namespace Application.Ringtoets.Storage.DbContext +{ + public class GeneralResultSubMechanismIllustrationPointEntity + { + [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] + public GeneralResultSubMechanismIllustrationPointEntity() + { + GrassCoverErosionOutwardsHydraulicLocationOutputEntities = new HashSet(); + HydraulicLocationOutputEntities = new HashSet(); + TopLevelSubMechanismIllustrationPointEntities = new HashSet(); + StochastEntities = new HashSet(); + } + + public long GeneralResultSubMechanismIllustrationPointEntityId { get; set; } + public string GoverningWindDirectionName { get; set; } + public double GoverningWindDirectionAngle { get; set; } + + [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection GrassCoverErosionOutwardsHydraulicLocationOutputEntities { get; set; } + + [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection HydraulicLocationOutputEntities { get; set; } + + [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection TopLevelSubMechanismIllustrationPointEntities { get; set; } + + [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection StochastEntities { get; set; } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GeneralResultSubmechanismIllustrationPointEntity.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsHydraulicLocationOutputEntity.cs =================================================================== diff -u -r54242411470f330f6f4c75d1d05bfd0911706873 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsHydraulicLocationOutputEntity.cs (.../GrassCoverErosionOutwardsHydraulicLocationOutputEntity.cs) (revision 54242411470f330f6f4c75d1d05bfd0911706873) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionOutwardsHydraulicLocationOutputEntity.cs (.../GrassCoverErosionOutwardsHydraulicLocationOutputEntity.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -34,9 +34,9 @@ { public long GrassCoverErosionOutwardsHydraulicLocationOutputEntityId { get; set; } public long GrassCoverErosionOutwardsHydraulicLocationEntityId { get; set; } - public long? GeneralResultSubmechanismIllustrationPointEntityId { get; set; } + public long? GeneralResultSubMechanismIllustrationPointEntityId { get; set; } - public virtual GeneralResultSubmechanismIllustrationPointEntity GeneralResultSubmechanismIllustrationPointEntity { get; set; } + public virtual GeneralResultSubMechanismIllustrationPointEntity GeneralResultSubMechanismIllustrationPointEntity { get; set; } public virtual GrassCoverErosionOutwardsHydraulicLocationEntity GrassCoverErosionOutwardsHydraulicLocationEntity { get; set; } public byte HydraulicLocationOutputType { get; set; } public double? Result { get; set; } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/HydraulicLocationOutputEntity.cs =================================================================== diff -u -r54242411470f330f6f4c75d1d05bfd0911706873 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/HydraulicLocationOutputEntity.cs (.../HydraulicLocationOutputEntity.cs) (revision 54242411470f330f6f4c75d1d05bfd0911706873) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/HydraulicLocationOutputEntity.cs (.../HydraulicLocationOutputEntity.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -34,9 +34,9 @@ { public long HydraulicLocationEntityOutputId { get; set; } public long HydraulicLocationEntityId { get; set; } - public long? GeneralResultSubmechanismIllustrationPointEntityId { get; set; } + public long? GeneralResultSubMechanismIllustrationPointEntityId { get; set; } - public virtual GeneralResultSubmechanismIllustrationPointEntity GeneralResultSubmechanismIllustrationPointEntity { get; set; } + public virtual GeneralResultSubMechanismIllustrationPointEntity GeneralResultSubMechanismIllustrationPointEntity { get; set; } public virtual HydraulicLocationEntity HydraulicLocationEntity { get; set; } public byte HydraulicLocationOutputType { get; set; } public double? Result { get; set; } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IllustrationPointResultEntity.cs =================================================================== diff -u -r54242411470f330f6f4c75d1d05bfd0911706873 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IllustrationPointResultEntity.cs (.../IllustrationPointResultEntity.cs) (revision 54242411470f330f6f4c75d1d05bfd0911706873) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IllustrationPointResultEntity.cs (.../IllustrationPointResultEntity.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -33,11 +33,11 @@ public class IllustrationPointResultEntity { public long IllustrationPointResultEntityId { get; set; } - public long SubmechanismIllustrationPointEntityId { get; set; } + public long SubMechanismIllustrationPointEntityId { get; set; } public string Description { get; set; } public double Value { get; set; } public int Order { get; set; } - public virtual SubmechanismIllustrationPointEntity SubmechanismIllustrationPointEntity { get; set; } + public virtual SubMechanismIllustrationPointEntity SubMechanismIllustrationPointEntity { get; set; } } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs =================================================================== diff -u -r54242411470f330f6f4c75d1d05bfd0911706873 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs (.../RingtoetsEntities.Context.cs) (revision 54242411470f330f6f4c75d1d05bfd0911706873) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs (.../RingtoetsEntities.Context.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -53,7 +53,7 @@ public virtual DbSet FailureMechanismEntities { get; set; } public virtual DbSet FailureMechanismSectionEntities { get; set; } public virtual DbSet ForeshoreProfileEntities { get; set; } - public virtual DbSet GeneralResultSubmechanismIllustrationPointEntities { get; set; } + public virtual DbSet GeneralResultSubMechanismIllustrationPointEntities { get; set; } public virtual DbSet GrassCoverErosionInwardsCalculationEntities { get; set; } public virtual DbSet GrassCoverErosionInwardsDikeHeightOutputEntities { get; set; } public virtual DbSet GrassCoverErosionInwardsFailureMechanismMetaEntities { get; set; } @@ -101,11 +101,11 @@ public virtual DbSet StochasticSoilModelEntities { get; set; } public virtual DbSet StochasticSoilProfileEntities { get; set; } public virtual DbSet StrengthStabilityLengthwiseConstructionSectionResultEntities { get; set; } - public virtual DbSet SubmechanismIllustrationPointEntities { get; set; } - public virtual DbSet SubmechanismIllustrationPointStochastEntities { get; set; } + public virtual DbSet SubMechanismIllustrationPointEntities { get; set; } + public virtual DbSet SubMechanismIllustrationPointStochastEntities { get; set; } public virtual DbSet SurfaceLineEntities { get; set; } public virtual DbSet TechnicalInnovationSectionResultEntities { get; set; } - public virtual DbSet TopLevelSubmechanismIllustrationPointEntities { get; set; } + public virtual DbSet TopLevelSubMechanismIllustrationPointEntities { get; set; } public virtual DbSet VersionEntities { get; set; } public virtual DbSet WaterPressureAsphaltCoverSectionResultEntities { get; set; } public virtual DbSet WaveImpactAsphaltCoverFailureMechanismMetaEntities { get; set; } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx =================================================================== diff -u -r54242411470f330f6f4c75d1d05bfd0911706873 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 54242411470f330f6f4c75d1d05bfd0911706873) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -284,20 +284,20 @@ - + - + - + - + - + - + @@ -411,7 +411,7 @@ - + @@ -602,7 +602,7 @@ - + @@ -616,7 +616,7 @@ - + @@ -1034,21 +1034,21 @@ - + - + - + - + - + - - + + @@ -1076,13 +1076,13 @@ - + - + - - - + + + @@ -1441,27 +1441,27 @@ - + - + - + - - - + + + - - + + - - + + @@ -1610,14 +1610,14 @@ - + - - + + - + @@ -1838,26 +1838,26 @@ - + - - + + - + - + - - + + - + @@ -2245,15 +2245,15 @@ - - - + + + - - + + - - + + @@ -2281,27 +2281,27 @@ - - - + + + - - + + - - + + - - - + + + - - + + - - + + @@ -2408,8 +2408,8 @@ - - + + @@ -2457,11 +2457,11 @@ - - + + - + @@ -2560,13 +2560,13 @@ - + - + - - - + + + @@ -2617,7 +2617,7 @@ - + @@ -2693,11 +2693,11 @@ - + - + @@ -2828,9 +2828,9 @@ - - - + + + @@ -2840,13 +2840,13 @@ - - - + + + - - - + + + @@ -2900,7 +2900,7 @@ - + @@ -2948,11 +2948,11 @@ - - + + - + @@ -3220,16 +3220,16 @@ - + - + - - - + + + @@ -3300,7 +3300,7 @@ - + @@ -3347,21 +3347,21 @@ - - - + + + - - - + + + - + - + @@ -3728,17 +3728,17 @@ - + - + - + - - - - + + + + @@ -3868,15 +3868,15 @@ - + - + @@ -4090,27 +4090,27 @@ - + - + - + - + @@ -4531,7 +4531,7 @@ - + @@ -4569,30 +4569,30 @@ - + - + - + - - - + + + - + - + - - + + - + @@ -4619,20 +4619,20 @@ - + - + - - - + + + - - + + @@ -5499,38 +5499,38 @@ - + - - + + - + - + - - + + - + - - - + + + - - + + - - + + @@ -5739,14 +5739,14 @@ - + - - + + - + @@ -5882,27 +5882,27 @@ - - - + + + - - + + - - + + - - - + + + - - + + - - + + @@ -5918,9 +5918,9 @@ - + - + @@ -6225,12 +6225,12 @@ - - - + + + - + @@ -6357,7 +6357,7 @@ - + @@ -6560,7 +6560,7 @@ - + @@ -6572,7 +6572,7 @@ - + @@ -7015,26 +7015,26 @@ - - - + + + - + - - - + + + - - + + @@ -7061,17 +7061,17 @@ - - - + + + - - - + + + @@ -7157,9 +7157,9 @@ - - - + + + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram =================================================================== diff -u -r54242411470f330f6f4c75d1d05bfd0911706873 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 54242411470f330f6f4c75d1d05bfd0911706873) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -6,82 +6,82 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + @@ -149,7 +149,7 @@ - + @@ -179,10 +179,10 @@ - - + + - + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StochastEntity.cs =================================================================== diff -u -r54242411470f330f6f4c75d1d05bfd0911706873 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StochastEntity.cs (.../StochastEntity.cs) (revision 54242411470f330f6f4c75d1d05bfd0911706873) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StochastEntity.cs (.../StochastEntity.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -38,7 +38,7 @@ [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] public StochastEntity() { - GeneralResultSubmechanismIllustrationPointEntities = new HashSet(); + GeneralResultSubMechanismIllustrationPointEntities = new HashSet(); } public long StochastEntityId { get; set; } @@ -48,6 +48,6 @@ public int Order { get; set; } [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection GeneralResultSubmechanismIllustrationPointEntities { get; set; } + public virtual ICollection GeneralResultSubMechanismIllustrationPointEntities { get; set; } } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/SubMechanismIllustrationPointEntity.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/SubMechanismIllustrationPointEntity.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/SubMechanismIllustrationPointEntity.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,60 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; + +namespace Application.Ringtoets.Storage.DbContext +{ + public class SubMechanismIllustrationPointEntity + { + [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] + public SubMechanismIllustrationPointEntity() + { + IllustrationPointResultEntities = new HashSet(); + SubMechanismIllustrationPointStochastEntities = new HashSet(); + TopLevelSubMechanismIllustrationPointEntities = new HashSet(); + } + + public long SubMechanismIllustrationPointEntityId { get; set; } + public string Name { get; set; } + public double Beta { get; set; } + public int Order { get; set; } + + [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection IllustrationPointResultEntities { get; set; } + + [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection SubMechanismIllustrationPointStochastEntities { get; set; } + + [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection TopLevelSubMechanismIllustrationPointEntities { get; set; } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/SubMechanismIllustrationPointStochastEntity.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/SubMechanismIllustrationPointStochastEntity.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/SubMechanismIllustrationPointStochastEntity.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,45 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Application.Ringtoets.Storage.DbContext +{ + public class SubMechanismIllustrationPointStochastEntity + { + public long SubMechanismIllustrationPointStochastEntityId { get; set; } + public long SubMechanismIllustrationPointEntityId { get; set; } + public string Name { get; set; } + public double Duration { get; set; } + public double Alpha { get; set; } + public double Realization { get; set; } + public int Order { get; set; } + + public virtual SubMechanismIllustrationPointEntity SubMechanismIllustrationPointEntity { get; set; } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/SubmechanismIllustrationPointEntity.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/SubmechanismIllustrationPointStochastEntity.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/TopLevelSubMechanismIllustrationPointEntity.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/TopLevelSubMechanismIllustrationPointEntity.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/TopLevelSubMechanismIllustrationPointEntity.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Application.Ringtoets.Storage.DbContext +{ + public class TopLevelSubMechanismIllustrationPointEntity + { + public long TopLevelSubMechanismIllustrationPointEntityId { get; set; } + public long GeneralResultSubMechanismIllustrationPointEntityId { get; set; } + public long SubMechanismIllustrationPointEntityId { get; set; } + public string ClosingSituation { get; set; } + public string WindDirectionName { get; set; } + public double WindDirectionAngle { get; set; } + public double Beta { get; set; } + public int Order { get; set; } + + public virtual GeneralResultSubMechanismIllustrationPointEntity GeneralResultSubMechanismIllustrationPointEntity { get; set; } + public virtual SubMechanismIllustrationPointEntity SubMechanismIllustrationPointEntity { get; set; } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/TopLevelSubmechanismIllustrationPointEntity.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/SubMechanismIllustrationPointEntityReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/SubMechanismIllustrationPointEntityReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/SubMechanismIllustrationPointEntityReadExtensions.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,82 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Application.Ringtoets.Storage.DbContext; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; + +namespace Application.Ringtoets.Storage.Read.IllustrationPoints +{ + /// + /// Extension methods for + /// related to creating a . + /// + internal static class SubMechanismIllustrationPointEntityReadExtensions + { + /// + /// Reads the and uses + /// the information to construct a . + /// + /// The + /// to create a for. + /// A new . + /// Thrown when + /// is null. + public static SubMechanismIllustrationPoint Read(this SubMechanismIllustrationPointEntity entity) + { + if (entity == null) + { + throw new ArgumentNullException(nameof(entity)); + } + + IEnumerable stochasts = + GetReadSubMechanismIllustrationPointStochasts(entity.SubMechanismIllustrationPointStochastEntities); + + IEnumerable illustrationPointResults = + GetReadIllustrationPointResults(entity.IllustrationPointResultEntities); + + return new SubMechanismIllustrationPoint(entity.Name, + stochasts, + illustrationPointResults, + entity.Beta); + } + + private static IEnumerable GetReadSubMechanismIllustrationPointStochasts( + IEnumerable stochastEntities) + { + var stochasts = new List(); + stochasts.AddRange(stochastEntities.OrderBy(st => st.Order) + .Select(st => st.Read())); + return stochasts; + } + + private static IEnumerable GetReadIllustrationPointResults( + IEnumerable illustrationPointResultEntities) + { + var illustrationPointResults = new List(); + illustrationPointResults.AddRange(illustrationPointResultEntities.OrderBy(ipr => ipr.Order) + .Select(ipr => ipr.Read())); + return illustrationPointResults; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/SubMechanismIllustrationPointStochastEntityReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/SubMechanismIllustrationPointStochastEntityReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/SubMechanismIllustrationPointStochastEntityReadExtensions.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,55 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Application.Ringtoets.Storage.DbContext; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; + +namespace Application.Ringtoets.Storage.Read.IllustrationPoints +{ + /// + /// Extension methods for + /// related to creating a . + /// + internal static class SubMechanismIllustrationPointStochastEntityReadExtensions + { + /// + /// Reads the + /// and use the information to construct a . + /// + /// The to create + /// for. + /// A new . + /// Thrown when is null. + public static SubMechanismIllustrationPointStochast Read(this SubMechanismIllustrationPointStochastEntity entity) + { + if (entity == null) + { + throw new ArgumentNullException(nameof(entity)); + } + + return new SubMechanismIllustrationPointStochast(entity.Name, + entity.Duration, + entity.Alpha, + entity.Realization); + } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/SubmechanismIllustrationPointEntityReadExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/IllustrationPoints/SubmechanismIllustrationPointStochastEntityReadExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -r548ebfbd35f147dc64cb0d566fe8f30ec2a0e434 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 548ebfbd35f147dc64cb0d566fe8f30ec2a0e434) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -91,8 +91,8 @@ - - + + Code @@ -126,8 +126,8 @@ - - + + Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/SubMechanismIllustrationPointCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/SubMechanismIllustrationPointCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/SubMechanismIllustrationPointCreateExtensionsTest.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,170 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Linq; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Application.Ringtoets.Storage.Create.IllustrationPoints; +using Application.Ringtoets.Storage.DbContext; +using Ringtoets.Common.Data.TestUtil; + +namespace Application.Ringtoets.Storage.Test.Create.IllustrationPoints +{ + [TestFixture] + public class SubMechanismIllustrationPointCreateExtensionsTest + { + [Test] + public void CreateSubMechanismIllustrationPoint_IllustrationPointNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => ((SubMechanismIllustrationPoint) null).CreateSubMechanismIllustrationPointEntity(); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("subMechanismIllustrationPoint", exception.ParamName); + } + + [Test] + public void CreateSubMechanismIllustrationPoint_SubMechanismIllustrationPointWithoutResultsAndStochasts_ReturnEntity() + { + // Setup + var random = new Random(21); + + const string illustrationPointName = "Illustration point name"; + double beta = random.NextDouble(); + var illustrationPoint = new SubMechanismIllustrationPoint(illustrationPointName, + Enumerable.Empty(), + Enumerable.Empty(), + beta); + + // Call + SubMechanismIllustrationPointEntity entity = illustrationPoint.CreateSubMechanismIllustrationPointEntity(); + + // Assert + Assert.AreEqual(illustrationPoint.Name, entity.Name); + Assert.AreEqual(illustrationPoint.Beta, entity.Beta, illustrationPoint.Beta.GetAccuracy()); + + CollectionAssert.IsEmpty(entity.IllustrationPointResultEntities); + CollectionAssert.IsEmpty(entity.SubMechanismIllustrationPointStochastEntities); + } + + [Test] + public void CreateSubMechanismIllustrationPoint_ValidIllustrationPointWithStochasts_ReturnEntity() + { + // Setup + var random = new Random(21); + + const string stochastName = "stochast name"; + double duration = random.NextDouble(); + double alpha = random.NextDouble(); + double realization = random.NextDouble(); + var stochastOne = new SubMechanismIllustrationPointStochast(stochastName, + duration, + alpha, + realization); + var stochastTwo = new SubMechanismIllustrationPointStochast($"{stochastName}_Two", + duration + 1, + alpha + 1, + realization + 1); + var stochasts = new[] + { + stochastOne, + stochastTwo + }; + + const string illustrationPointName = "Illustration point name"; + double beta = random.NextDouble(); + var illustrationPoint = new SubMechanismIllustrationPoint(illustrationPointName, + stochasts, + Enumerable.Empty(), + beta); + + // Call + SubMechanismIllustrationPointEntity entity = illustrationPoint.CreateSubMechanismIllustrationPointEntity(); + + // Assert + Assert.AreEqual(illustrationPoint.Name, entity.Name); + Assert.AreEqual(illustrationPoint.Beta, entity.Beta, illustrationPoint.Beta.GetAccuracy()); + CollectionAssert.IsEmpty(entity.IllustrationPointResultEntities); + + SubMechanismIllustrationPointStochastEntity[] stochastEntities = entity.SubMechanismIllustrationPointStochastEntities.ToArray(); + int expectedNrOfStochasts = stochasts.Length; + Assert.AreEqual(expectedNrOfStochasts, stochastEntities.Length); + for (var i = 0; i < expectedNrOfStochasts; i++) + { + SubMechanismIllustrationPointStochast stochast = stochasts[i]; + SubMechanismIllustrationPointStochastEntity stochastEntity = stochastEntities[i]; + + Assert.AreEqual(stochast.Name, stochastEntity.Name); + Assert.AreEqual(stochast.Duration, stochastEntity.Duration, stochast.Duration.GetAccuracy()); + Assert.AreEqual(stochast.Alpha, stochastEntity.Alpha, stochast.Alpha.GetAccuracy()); + Assert.AreEqual(stochast.Realization, stochastEntity.Realization, stochast.Realization.GetAccuracy()); + } + } + + [Test] + public void CreateSubMechanismIllustrationPoint_MultipleResultsAndValidIllustrationPoint_ReturnEntity() + { + // Setup + var random = new Random(21); + + const string resultDescription = "result description"; + double value = random.NextDouble(); + var illustrationPointResultOne = new IllustrationPointResult(resultDescription, value); + var illustrationPointResultTwo = new IllustrationPointResult($"{resultDescription}_Two", value + 1); + var illustrationPointResults = new[] + { + illustrationPointResultOne, + illustrationPointResultTwo + }; + + const string illustrationPointName = "Illustration point name"; + double beta = random.NextDouble(); + + var illustrationPoint = new SubMechanismIllustrationPoint(illustrationPointName, + Enumerable.Empty(), + illustrationPointResults, + beta); + + // Call + SubMechanismIllustrationPointEntity entity = illustrationPoint.CreateSubMechanismIllustrationPointEntity(); + + // Assert + Assert.AreEqual(illustrationPoint.Name, entity.Name); + Assert.AreEqual(illustrationPoint.Beta, entity.Beta, illustrationPoint.Beta.GetAccuracy()); + CollectionAssert.IsEmpty(entity.SubMechanismIllustrationPointStochastEntities); + + IllustrationPointResultEntity[] resultEntities = entity.IllustrationPointResultEntities.ToArray(); + int expectedNrOfIllustrationPoints = illustrationPointResults.Length; + Assert.AreEqual(expectedNrOfIllustrationPoints, resultEntities.Length); + for (var i = 0; i < expectedNrOfIllustrationPoints; i++) + { + IllustrationPointResult illustrationPointResult = illustrationPointResults[i]; + IllustrationPointResultEntity illustrationPointResultEntity = resultEntities[i]; + + Assert.AreEqual(illustrationPointResult.Description, illustrationPointResultEntity.Description); + Assert.AreEqual(illustrationPointResult.Value, illustrationPointResultEntity.Value, + illustrationPointResult.Value.GetAccuracy()); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/SubMechanismIllustrationPointStochastCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/SubMechanismIllustrationPointStochastCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/SubMechanismIllustrationPointStochastCreateExtensionsTest.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,68 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Application.Ringtoets.Storage.Create.IllustrationPoints; +using Application.Ringtoets.Storage.DbContext; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil; + +namespace Application.Ringtoets.Storage.Test.Create.IllustrationPoints +{ + [TestFixture] + public class SubMechanismIllustrationPointStochastCreateExtensionsTest + { + [Test] + public void CreateSubMechanismIllustrationPointStochastEntity_StochastNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => ((SubMechanismIllustrationPointStochast) null).CreateSubMechanismIllustrationPointStochastEntity(0); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("subMechanismIllustrationPointStochast", paramName); + } + + [Test] + public void CreateSubMechanismIllustrationPointStochastEntity_ValidRealizedStochast_ReturnEntity() + { + // Setup + var random = new Random(123); + var stochast = new SubMechanismIllustrationPointStochast("Some description", + random.NextDouble(), + random.NextDouble(), + random.NextDouble()); + int order = random.Next(); + + // Call + SubMechanismIllustrationPointStochastEntity entity = stochast.CreateSubMechanismIllustrationPointStochastEntity(order); + + // Assert + TestHelper.AssertAreEqualButNotSame(stochast.Name, entity.Name); + Assert.AreEqual(stochast.Alpha, entity.Alpha, stochast.Alpha.GetAccuracy()); + Assert.AreEqual(stochast.Duration, entity.Duration, stochast.Duration.GetAccuracy()); + Assert.AreEqual(stochast.Realization, entity.Realization, stochast.Realization.GetAccuracy()); + Assert.AreEqual(order, entity.Order); + } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/SubmechanismIllustrationPointCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/SubmechanismIllustrationPointStochastCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IllustrationPoints/SubMechanismIllustrationPointReadExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IllustrationPoints/SubMechanismIllustrationPointReadExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IllustrationPoints/SubMechanismIllustrationPointReadExtensionsTest.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,198 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Linq; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.Read.IllustrationPoints; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil; + +namespace Application.Ringtoets.Storage.Test.Read.IllustrationPoints +{ + [TestFixture] + public class SubMechanismIllustrationPointReadExtensionsTest + { + [Test] + public void Read_EntityNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => ((SubMechanismIllustrationPointEntity) null).Read(); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("entity", exception.ParamName); + } + + [Test] + public void Read_ValidEntityWithoutStochastsAndIllustrationPointResults_ReturnsSubMechanismIllustrationPoint() + { + // Setup + var random = new Random(21); + + const string illustrationPointName = "Name"; + double beta = random.NextDouble(); + var entity = new SubMechanismIllustrationPointEntity + { + Name = illustrationPointName, + Beta = beta + }; + + // Call + SubMechanismIllustrationPoint illustrationPoint = entity.Read(); + + // Assert + Assert.AreEqual(entity.Name, illustrationPoint.Name); + Assert.AreEqual(entity.Beta, illustrationPoint.Beta, illustrationPoint.Beta.GetAccuracy()); + + CollectionAssert.IsEmpty(illustrationPoint.IllustrationPointResults); + CollectionAssert.IsEmpty(illustrationPoint.Stochasts); + } + + [Test] + public void Read_ValidEntityWithIllustrationPointResults_ReturnsSubMechanismIllustrationPoint() + { + // Setup + var random = new Random(21); + + const string illustrationPointResultDescription = "Description"; + double value = random.NextDouble(); + var illustrationPointResultEntityOne = new IllustrationPointResultEntity + { + Description = illustrationPointResultDescription, + Value = value, + Order = 0 + }; + var illustrationPointResultEntityTwo = new IllustrationPointResultEntity + { + Description = $"{illustrationPointResultDescription}_Two", + Value = value + 1, + Order = 1 + }; + + const string illustrationPointName = "Name"; + double beta = random.NextDouble(); + var entity = new SubMechanismIllustrationPointEntity + { + Name = illustrationPointName, + Beta = beta, + IllustrationPointResultEntities = new[] + { + illustrationPointResultEntityTwo, + illustrationPointResultEntityOne + } + }; + + // Call + SubMechanismIllustrationPoint illustrationPoint = entity.Read(); + + // Assert + Assert.AreEqual(entity.Name, illustrationPoint.Name); + Assert.AreEqual(entity.Beta, illustrationPoint.Beta, illustrationPoint.Beta.GetAccuracy()); + CollectionAssert.IsEmpty(illustrationPoint.Stochasts); + + IllustrationPointResult[] illustrationPointResults = illustrationPoint.IllustrationPointResults.ToArray(); + Assert.AreEqual(2, illustrationPointResults.Length); + + IllustrationPointResult resultOne = illustrationPointResults[0]; + AssertReadIllustrationPointResult(illustrationPointResultEntityOne, resultOne); + + IllustrationPointResult resultTwo = illustrationPointResults[1]; + AssertReadIllustrationPointResult(illustrationPointResultEntityTwo, resultTwo); + } + + [Test] + public void Read_ValidEntityWithStochasts_ReturnsSubMechanismIllustrationPoint() + { + // Setup + var random = new Random(21); + + const string stochastName = "Stochast"; + double alpha = random.NextDouble(); + double realization = random.NextDouble(); + double duration = random.NextDouble(); + var stochastEntityOne = new SubMechanismIllustrationPointStochastEntity + { + Name = stochastName, + Alpha = alpha, + Duration = duration, + Realization = realization, + Order = 0 + }; + var stochastEntityTwo = new SubMechanismIllustrationPointStochastEntity + { + Name = $"{stochastName}_Two", + Alpha = alpha + 1, + Duration = duration + 1, + Realization = realization + 1, + Order = 1 + }; + + const string illustrationPointName = "Name"; + double beta = random.NextDouble(); + var entity = new SubMechanismIllustrationPointEntity + { + Name = illustrationPointName, + Beta = beta, + SubMechanismIllustrationPointStochastEntities = new[] + { + stochastEntityTwo, + stochastEntityOne + } + }; + + // Call + SubMechanismIllustrationPoint illustrationPoint = entity.Read(); + + // Assert + Assert.AreEqual(entity.Name, illustrationPoint.Name); + Assert.AreEqual(entity.Beta, illustrationPoint.Beta, illustrationPoint.Beta.GetAccuracy()); + CollectionAssert.IsEmpty(illustrationPoint.IllustrationPointResults); + + SubMechanismIllustrationPointStochast[] stochasts = illustrationPoint.Stochasts.ToArray(); + Assert.AreEqual(2, stochasts.Length); + + SubMechanismIllustrationPointStochast readStochastOne = stochasts[0]; + AssertReadStochast(stochastEntityOne, readStochastOne); + + SubMechanismIllustrationPointStochast readStochastTwo = stochasts[1]; + AssertReadStochast(stochastEntityTwo, readStochastTwo); + } + + private static void AssertReadIllustrationPointResult(IllustrationPointResultEntity illustrationPointResultEntity, + IllustrationPointResult readIllustrationPointResult) + { + Assert.AreEqual(illustrationPointResultEntity.Description, readIllustrationPointResult.Description); + Assert.AreEqual(illustrationPointResultEntity.Value, readIllustrationPointResult.Value, + readIllustrationPointResult.Value.GetAccuracy()); + } + + private static void AssertReadStochast(SubMechanismIllustrationPointStochastEntity stochastEntity, + SubMechanismIllustrationPointStochast readStochast) + { + Assert.AreEqual(stochastEntity.Name, readStochast.Name); + Assert.AreEqual(stochastEntity.Alpha, readStochast.Alpha, readStochast.Alpha.GetAccuracy()); + Assert.AreEqual(stochastEntity.Duration, readStochast.Duration, readStochast.Duration.GetAccuracy()); + Assert.AreEqual(stochastEntity.Realization, readStochast.Realization, readStochast.Realization.GetAccuracy()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IllustrationPoints/SubMechanismIllustrationPointStochastEntityReadExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IllustrationPoints/SubMechanismIllustrationPointStochastEntityReadExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IllustrationPoints/SubMechanismIllustrationPointStochastEntityReadExtensionsTest.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,68 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Application.Ringtoets.Storage.DbContext; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil; +using Application.Ringtoets.Storage.Read.IllustrationPoints; + +namespace Application.Ringtoets.Storage.Test.Read.IllustrationPoints +{ + [TestFixture] + public class SubMechanismIllustrationPointStochastEntityReadExtensionsTest + { + [Test] + public void Read_EntityNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => ((SubMechanismIllustrationPointStochastEntity) null).Read(); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("entity", paramName); + } + + [Test] + public void Read_ValidEntity_ReturnRealizedStochast() + { + // Setup + var random = new Random(123); + var entity = new SubMechanismIllustrationPointStochastEntity + { + Name = "Description", + Alpha = random.NextDouble(), + Duration = random.NextDouble(), + Realization = random.NextDouble() + }; + + // Call + SubMechanismIllustrationPointStochast illustrationPointResult = entity.Read(); + + // Assert + Assert.AreEqual(entity.Name, illustrationPointResult.Name); + Assert.AreEqual(entity.Alpha, illustrationPointResult.Alpha, illustrationPointResult.Alpha.GetAccuracy()); + Assert.AreEqual(entity.Duration, illustrationPointResult.Duration, illustrationPointResult.Duration.GetAccuracy()); + Assert.AreEqual(entity.Realization, illustrationPointResult.Realization, illustrationPointResult.Realization.GetAccuracy()); + } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IllustrationPoints/SubmechanismIllustrationPointReadExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IllustrationPoints/SubmechanismIllustrationPointStochastEntityReadExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/GeneralResult.cs =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/GeneralResult.cs (.../GeneralResult.cs) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/GeneralResult.cs (.../GeneralResult.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -34,13 +34,13 @@ /// /// The governing wind direction. /// The general alpha values. - /// A collections of all + /// A collections of all /// the combinations of wind directions, closing situations and illustration points. /// Thrown when , - /// or is null. + /// or is null. public GeneralResult(WindDirection governingWindDirection, IEnumerable stochasts, - IEnumerable topLevelSubmechanismIllustrationPoints) + IEnumerable topLevelSubMechanismIllustrationPoints) { if (governingWindDirection == null) { @@ -50,14 +50,14 @@ { throw new ArgumentNullException(nameof(stochasts)); } - if (topLevelSubmechanismIllustrationPoints == null) + if (topLevelSubMechanismIllustrationPoints == null) { - throw new ArgumentNullException(nameof(topLevelSubmechanismIllustrationPoints)); + throw new ArgumentNullException(nameof(topLevelSubMechanismIllustrationPoints)); } GoverningWindDirection = governingWindDirection; Stochasts = stochasts; - TopLevelSubmechanismIllustrationPoints = topLevelSubmechanismIllustrationPoints; + TopLevelSubMechanismIllustrationPoints = topLevelSubMechanismIllustrationPoints; } /// @@ -73,6 +73,6 @@ /// /// Gets all the top level combinations of wind directions, closing situation and illustration points. /// - public IEnumerable TopLevelSubmechanismIllustrationPoints { get; } + public IEnumerable TopLevelSubMechanismIllustrationPoints { get; } } } \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/SubMechanismIllustrationPoint.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/SubMechanismIllustrationPoint.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/SubMechanismIllustrationPoint.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,92 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using Core.Common.Base.Data; + +namespace Ringtoets.Common.Data.Hydraulics.IllustrationPoints +{ + /// + /// Illustration point which contains the results. + /// + public class SubMechanismIllustrationPoint + { + /// + /// Creates a new instance of . + /// + /// The name of the illustration point result + /// The stochasts for the sub mechanism illustration point. + /// The output variables. + /// The beta value that was realized. + /// Thrown when any of: + /// + /// + /// + /// + /// + /// is null. + public SubMechanismIllustrationPoint(string name, + IEnumerable stochasts, + IEnumerable illustrationPointResults, + double beta) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + if (stochasts == null) + { + throw new ArgumentNullException(nameof(stochasts)); + } + if (illustrationPointResults == null) + { + throw new ArgumentNullException(nameof(illustrationPointResults)); + } + + Name = name; + Beta = new RoundedDouble(5, beta); + + Stochasts = stochasts; + IllustrationPointResults = illustrationPointResults; + } + + /// + /// Gets the name of the illustration point. + /// + public string Name { get; } + + /// + /// Gets the beta value that was realized. + /// + public RoundedDouble Beta { get; } + + /// + /// Gets the stochasts that belong to this submechanism illustration point. + /// + public IEnumerable Stochasts { get; } + + /// + /// Gets the output variables. + /// + public IEnumerable IllustrationPointResults { get; } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/SubMechanismIllustrationPointStochast.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/SubMechanismIllustrationPointStochast.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/SubMechanismIllustrationPointStochast.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,52 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base.Data; + +namespace Ringtoets.Common.Data.Hydraulics.IllustrationPoints +{ + /// + /// Container of alpha value definitions which contain a realization. + /// + public class SubMechanismIllustrationPointStochast : Stochast + { + /// + /// Creates a new instance of . + /// + /// The name of the stochast. + /// The duration. + /// The alpha value of the stochast. + /// The realization of the stochast. + /// Thrown when + /// is null. + public SubMechanismIllustrationPointStochast(string name, double duration, double alpha, double realization) + : base(name, duration, alpha) + { + Realization = new RoundedDouble(5, realization); + } + + /// + /// Gets the realization of the stochast. + /// + public RoundedDouble Realization { get; } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/SubmechanismIllustrationPoint.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/SubmechanismIllustrationPointStochast.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/TopLevelSubMechanismIllustrationPoint.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/TopLevelSubMechanismIllustrationPoint.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/TopLevelSubMechanismIllustrationPoint.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,76 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; + +namespace Ringtoets.Common.Data.Hydraulics.IllustrationPoints +{ + /// + /// Represents the top level combination of , closing situation and + /// . + /// + public class TopLevelSubMechanismIllustrationPoint + { + /// + /// Creates an instance of . + /// + /// The wind direction. + /// The closing situation. + /// The illustrationPoint. + /// Thrown when any input parameter is null. + public TopLevelSubMechanismIllustrationPoint(WindDirection windDirection, + string closingSituation, + SubMechanismIllustrationPoint subMechanismIllustrationPoint) + { + if (windDirection == null) + { + throw new ArgumentNullException(nameof(windDirection)); + } + if (closingSituation == null) + { + throw new ArgumentNullException(nameof(closingSituation)); + } + if (subMechanismIllustrationPoint == null) + { + throw new ArgumentNullException(nameof(subMechanismIllustrationPoint)); + } + + WindDirection = windDirection; + ClosingSituation = closingSituation; + SubMechanismIllustrationPoint = subMechanismIllustrationPoint; + } + + /// + /// Gets the closing situation. + /// + public string ClosingSituation { get; } + + /// + /// Gets the wind direction. + /// + public WindDirection WindDirection { get; } + + /// + /// Gets the submechanism illustration point. + /// + public SubMechanismIllustrationPoint SubMechanismIllustrationPoint { get; } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/TopLevelSubmechanismIllustrationPoint.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -69,12 +69,12 @@ - + - + - + Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsStackChartDataFactory.cs =================================================================== diff -u -r82beae540257b0a91094838c1a020d043431a93a -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsStackChartDataFactory.cs (.../RingtoetsStackChartDataFactory.cs) (revision 82beae540257b0a91094838c1a020d043431a93a) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsStackChartDataFactory.cs (.../RingtoetsStackChartDataFactory.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -62,7 +62,7 @@ throw new ArgumentNullException(nameof(stackChartData)); } - Tuple[] labels = generalResult.TopLevelSubmechanismIllustrationPoints + Tuple[] labels = generalResult.TopLevelSubMechanismIllustrationPoints .Select(illustrationPoint => new Tuple(illustrationPoint.WindDirection.Name, illustrationPoint.ClosingSituation)) @@ -104,9 +104,9 @@ var stochastValues = new List>(); - foreach (TopLevelSubmechanismIllustrationPoint illustrationPoint in generalResult.TopLevelSubmechanismIllustrationPoints) + foreach (TopLevelSubMechanismIllustrationPoint illustrationPoint in generalResult.TopLevelSubMechanismIllustrationPoints) { - stochastValues.AddRange(illustrationPoint.SubmechanismIllustrationPoint.Stochasts + stochastValues.AddRange(illustrationPoint.SubMechanismIllustrationPoint.Stochasts .Select(illustrationPointStochast => new Tuple(illustrationPointStochast.Name, Math.Pow(illustrationPointStochast.Alpha, 2)))); Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TopLevelSubMechanismIllustrationPointProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TopLevelSubMechanismIllustrationPointProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TopLevelSubMechanismIllustrationPointProperties.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,133 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.ComponentModel; +using System.Linq; +using Core.Common.Base.Data; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.Converters; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Forms.TypeConverters; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// ViewModel of for properties panel. + /// + [TypeConverter(typeof(ExpandableObjectConverter))] + public class TopLevelSubMechanismIllustrationPointProperties : ObjectProperties + { + [PropertyOrder(1)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedProbability_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedProbability_Description))] + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double CalculatedProbability + { + get + { + return StatisticsConverter.ReliabilityToProbability(data.SubMechanismIllustrationPoint.Beta); + + } + } + + [PropertyOrder(2)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedReliability_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedReliability_Description))] + [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + public RoundedDouble CalculatedReliability + { + get + { + return data.SubMechanismIllustrationPoint.Beta; + } + } + + [PropertyOrder(3)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_WindDirection_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_WindDirection_Description))] + public string WindDirection + { + get + { + return data.WindDirection.Name; + } + } + + [PropertyOrder(4)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_ClosingSituation_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_ClosingSituation_Description))] + public string ClosingSituation + { + get + { + return data.ClosingSituation; + } + } + + [PropertyOrder(5)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_AlphaValues_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_AlphaValues_Description))] + [TypeConverter(typeof(KeyValueExpandableArrayConverter))] + [KeyValueElement(nameof(SubMechanismIllustrationPointStochast.Name), nameof(SubMechanismIllustrationPointStochast.Alpha))] + public SubMechanismIllustrationPointStochast[] AlphaValues + { + get + { + return data.SubMechanismIllustrationPoint.Stochasts.ToArray(); + } + } + + [PropertyOrder(6)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Durations_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Durations_Description))] + [TypeConverter(typeof(KeyValueExpandableArrayConverter))] + [KeyValueElement(nameof(SubMechanismIllustrationPointStochast.Name), nameof(SubMechanismIllustrationPointStochast.Duration))] + public SubMechanismIllustrationPointStochast[] Durations + { + get + { + return data.SubMechanismIllustrationPoint.Stochasts.ToArray(); + } + } + + [PropertyOrder(7)] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_Values_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_Values_Description))] + [TypeConverter(typeof(KeyValueExpandableArrayConverter))] + [KeyValueElement(nameof(IllustrationPointResult.Description), nameof(IllustrationPointResult.Value))] + public IllustrationPointResult[] IllustrationPointResults + { + get + { + return data.SubMechanismIllustrationPoint.IllustrationPointResults.ToArray(); + } + } + + public override string ToString() + { + return $"{data.SubMechanismIllustrationPoint.Name}"; + } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TopLevelSubmechanismIllustrationPointProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r82beae540257b0a91094838c1a020d043431a93a -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 82beae540257b0a91094838c1a020d043431a93a) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -101,7 +101,7 @@ - + UserControl Index: Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/GeneralResultConverter.cs =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/GeneralResultConverter.cs (.../GeneralResultConverter.cs) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/GeneralResultConverter.cs (.../GeneralResultConverter.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -52,7 +52,7 @@ WindDirection windDirection = WindDirectionConverter.CreateWindDirection(hydraGeneralResult.GoverningWindDirection); IEnumerable stochasts = GetStochasts(hydraGeneralResult); - IEnumerable windDirectionClosingScenarioIllustrationPoints = + IEnumerable windDirectionClosingScenarioIllustrationPoints = GetWindDirectionClosingSituationIllustrationPoint(hydraGeneralResult); return new GeneralResult(windDirection, stochasts, windDirectionClosingScenarioIllustrationPoints); @@ -63,10 +63,10 @@ return hydraGeneralResult.Stochasts.Select(StochastConverter.CreateStochast); } - private static IEnumerable GetWindDirectionClosingSituationIllustrationPoint( + private static IEnumerable GetWindDirectionClosingSituationIllustrationPoint( HydraGeneralResult hydraGeneralResult) { - var combinations = new List(); + var combinations = new List(); foreach (KeyValuePair illustrationPointTreeNode in hydraGeneralResult.IllustrationPoints) { IHydraRingIllustrationPoint hydraIllustrationPoint = illustrationPointTreeNode.Value.Data; @@ -75,7 +75,7 @@ var subMechanismIllustrationPoint = hydraIllustrationPoint as SubmechanismIllustrationPoint; if (subMechanismIllustrationPoint != null) { - combinations.Add(TopLevelSubmechanismIllustrationPointConverter.CreateWindDirectionClosingScenarioIllustrationPoint( + combinations.Add(TopLevelSubMechanismIllustrationPointConverter.CreateTopLevelSubMechanismIllustrationPoint( hydraWindDirectionClosingSituation, subMechanismIllustrationPoint)); } } Index: Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/StochastConverter.cs =================================================================== diff -u -r20c6cddf9031f8721e60fceba6b3a6bc2791522a -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/StochastConverter.cs (.../StochastConverter.cs) (revision 20c6cddf9031f8721e60fceba6b3a6bc2791522a) +++ Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/StochastConverter.cs (.../StochastConverter.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -49,20 +49,20 @@ } /// - /// Creates a new instance of based on the information of . + /// Creates a new instance of based on the information of . /// /// The to base the - /// to create on. + /// to create on. /// The newly created . /// Thrown when /// is null. - public static SubmechanismIllustrationPointStochast CreateSubmechanismIllustrationStochast(HydraSubmechanismIllustrationPointStochast hydraSubmechanismIllustrationPointStochast) + public static SubMechanismIllustrationPointStochast CreateSubMechanismIllustrationStochast(HydraSubmechanismIllustrationPointStochast hydraSubmechanismIllustrationPointStochast) { if (hydraSubmechanismIllustrationPointStochast == null) { throw new ArgumentNullException(nameof(hydraSubmechanismIllustrationPointStochast)); } - return new SubmechanismIllustrationPointStochast(hydraSubmechanismIllustrationPointStochast.Name, + return new SubMechanismIllustrationPointStochast(hydraSubmechanismIllustrationPointStochast.Name, hydraSubmechanismIllustrationPointStochast.Duration, hydraSubmechanismIllustrationPointStochast.Alpha, hydraSubmechanismIllustrationPointStochast.Realization); Index: Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/SubMechanismIllustrationPointConverter.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/SubMechanismIllustrationPointConverter.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/SubMechanismIllustrationPointConverter.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,63 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints; +using HydraSubmechanismIllustrationPoint = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.SubmechanismIllustrationPoint; +using IllustrationPointResult = Ringtoets.Common.Data.Hydraulics.IllustrationPoints.IllustrationPointResult; + +namespace Ringtoets.Common.Service.IllustrationPoints +{ + /// + /// The converter that converts data into data. + /// + public static class SubMechanismIllustrationPointConverter + { + /// + /// Creates a new instance of based on the information of . + /// + /// The to base the + /// to create on. + /// The newly created . + /// Thrown when + /// is null. + public static SubMechanismIllustrationPoint CreateSubMechanismIllustrationPoint(HydraSubmechanismIllustrationPoint subMechanismIllustrationPoint) + { + if (subMechanismIllustrationPoint == null) + { + throw new ArgumentNullException(nameof(subMechanismIllustrationPoint)); + } + + IEnumerable stochasts = subMechanismIllustrationPoint + .Stochasts.Select(StochastConverter.CreateSubMechanismIllustrationStochast); + IEnumerable illustrationPointResults = subMechanismIllustrationPoint + .Results.Select(IllustrationPointResultConverter.CreateIllustrationPointResult); + + return new SubMechanismIllustrationPoint(subMechanismIllustrationPoint.Name, + stochasts, + illustrationPointResults, + subMechanismIllustrationPoint.Beta); + } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/SubmechanismIllustrationPointConverter.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/TopLevelSubMechanismIllustrationPointConverter.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/TopLevelSubMechanismIllustrationPointConverter.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/TopLevelSubMechanismIllustrationPointConverter.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,70 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints; +using HydraSubmechanismIllustrationPoint = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.SubmechanismIllustrationPoint; +using WindDirection = Ringtoets.Common.Data.Hydraulics.IllustrationPoints.WindDirection; + +namespace Ringtoets.Common.Service.IllustrationPoints +{ + /// + /// Converter for and + /// related to creating a + /// . + /// + public static class TopLevelSubMechanismIllustrationPointConverter + { + /// + /// Creates a new instance of + /// based on the information of + /// and . + /// + /// The + /// to base the on. + /// The + /// to base the on. + /// A . + /// Thrown when any parameter is null. + public static TopLevelSubMechanismIllustrationPoint CreateTopLevelSubMechanismIllustrationPoint( + WindDirectionClosingSituation hydraWindDirectionClosingSituation, + HydraSubmechanismIllustrationPoint hydraSubmechanismIllustrationPoint) + { + if (hydraWindDirectionClosingSituation == null) + { + throw new ArgumentNullException(nameof(hydraWindDirectionClosingSituation)); + } + if (hydraSubmechanismIllustrationPoint == null) + { + throw new ArgumentNullException(nameof(hydraSubmechanismIllustrationPoint)); + } + + WindDirection windDirection = WindDirectionConverter.CreateWindDirection(hydraWindDirectionClosingSituation.WindDirection); + SubMechanismIllustrationPoint subMechanismIllustrationPoint = + SubMechanismIllustrationPointConverter.CreateSubMechanismIllustrationPoint(hydraSubmechanismIllustrationPoint); + + return new TopLevelSubMechanismIllustrationPoint(windDirection, + hydraWindDirectionClosingSituation.ClosingSituation, + subMechanismIllustrationPoint); + } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Service/IllustrationPoints/TopLevelSubmechanismIllustrationPointConverter.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -49,10 +49,10 @@ - + - + Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/GeneralResultTest.cs =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/GeneralResultTest.cs (.../GeneralResultTest.cs) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/GeneralResultTest.cs (.../GeneralResultTest.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -37,7 +37,7 @@ // Call TestDelegate call = () => new GeneralResult(null, Enumerable.Empty(), - Enumerable.Empty()); + Enumerable.Empty()); // Assert string paramName = Assert.Throws(call).ParamName; @@ -53,15 +53,15 @@ // Call TestDelegate call = () => new GeneralResult(windDirection, null, - Enumerable.Empty()); + Enumerable.Empty()); // Assert string paramName = Assert.Throws(call).ParamName; Assert.AreEqual("stochasts", paramName); } [Test] - public void Constructor_TopLevelSubmechanismIllustrationPointsNull_ThrowsArgumentNullException() + public void Constructor_TopLevelSubMechanismIllustrationPointsNull_ThrowsArgumentNullException() { // Setup var windDirection = new TestWindDirection(); @@ -73,7 +73,7 @@ // Assert string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("topLevelSubmechanismIllustrationPoints", paramName); + Assert.AreEqual("topLevelSubMechanismIllustrationPoints", paramName); } [Test] @@ -82,16 +82,16 @@ // Setup var windDirection = new TestWindDirection(); IEnumerable stochasts = Enumerable.Empty(); - IEnumerable combinations = - Enumerable.Empty(); + IEnumerable combinations = + Enumerable.Empty(); // Call var generalResult = new GeneralResult(windDirection, stochasts, combinations); // Assert Assert.AreSame(windDirection, generalResult.GoverningWindDirection); Assert.AreSame(stochasts, generalResult.Stochasts); - Assert.AreSame(combinations, generalResult.TopLevelSubmechanismIllustrationPoints); + Assert.AreSame(combinations, generalResult.TopLevelSubMechanismIllustrationPoints); } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/SubMechanismIllustrationPointStochastTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/SubMechanismIllustrationPointStochastTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/SubMechanismIllustrationPointStochastTest.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,57 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil; + +namespace Ringtoets.Common.Data.Test.Hydraulics.IllustrationPoints +{ + [TestFixture] + public class SubMechanismIllustrationPointStochastTest + { + [Test] + public void Constructor_ValidArguments_ReturnExpectedValues() + { + // Setup + const string name = "Stochast name"; + + var random = new Random(21); + double duration = random.NextDouble(); + double alpha = random.NextDouble(); + double realization = random.NextDouble(); + + // Call + var stochast = new SubMechanismIllustrationPointStochast(name, duration, alpha, realization); + + // Assert + Assert.IsInstanceOf(stochast); + Assert.AreEqual(name, stochast.Name); + Assert.AreEqual(duration, stochast.Duration, stochast.Duration.GetAccuracy()); + Assert.AreEqual(alpha, stochast.Alpha, stochast.Alpha.GetAccuracy()); + + Assert.AreEqual(realization, stochast.Realization, + stochast.Realization.GetAccuracy()); + Assert.AreEqual(5, stochast.Realization.NumberOfDecimalPlaces); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/SubMechanismIllustrationPointTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/SubMechanismIllustrationPointTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/SubMechanismIllustrationPointTest.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,113 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil; + +namespace Ringtoets.Common.Data.Test.Hydraulics.IllustrationPoints +{ + [TestFixture] + public class SubMechanismIllustrationPointTest + { + [Test] + public void Constructor_NameNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(21); + double beta = random.NextDouble(); + + // Call + TestDelegate call = () => new SubMechanismIllustrationPoint(null, + Enumerable.Empty(), + Enumerable.Empty(), + beta); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("name", exception.ParamName); + } + + [Test] + public void Constructor_StochastsNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(21); + double beta = random.NextDouble(); + + // Call + TestDelegate call = () => new SubMechanismIllustrationPoint("Illustration Point", + null, + Enumerable.Empty(), + beta); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("stochasts", exception.ParamName); + } + + [Test] + public void Constructor_IlustrationPointResultsNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(21); + double beta = random.NextDouble(); + + // Call + TestDelegate call = () => new SubMechanismIllustrationPoint("Illustration Point", + Enumerable.Empty(), + null, + beta); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("illustrationPointResults", exception.ParamName); + } + + [Test] + public void Constructor_ValidArguments_ReturnsExpectedValues() + { + // Setup + const string name = "Illustration Point"; + var random = new Random(21); + double beta = random.NextDouble(); + + var stochasts = new List(); + var illustrationPointResults = new List(); + + // Call + var illustrationPoint = new SubMechanismIllustrationPoint(name, + stochasts, + illustrationPointResults, + beta); + + // Assert + Assert.AreEqual(name, illustrationPoint.Name); + Assert.AreEqual(beta, illustrationPoint.Beta, illustrationPoint.Beta.GetAccuracy()); + Assert.AreEqual(5, illustrationPoint.Beta.NumberOfDecimalPlaces); + Assert.AreSame(stochasts, illustrationPoint.Stochasts); + Assert.AreSame(illustrationPointResults, illustrationPoint.IllustrationPointResults); + } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/SubmechanismIllustrationPointStochastTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/SubmechanismIllustrationPointTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/TopLevelSubMechanismIllustrationPointTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/TopLevelSubMechanismIllustrationPointTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/TopLevelSubMechanismIllustrationPointTest.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,96 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; + +namespace Ringtoets.Common.Data.Test.Hydraulics.IllustrationPoints +{ + [TestFixture] + public class TopLevelSubMechanismIllustrationPointTest + { + [Test] + public void Constructor_WindDirectionNull_ThrowsArgumentNullException() + { + // Setup + var submechanismIllustrationPoint = new TestSubMechanismIllustrationPoint(); + + // Call + TestDelegate call = () => + new TopLevelSubMechanismIllustrationPoint(null, "closing situation", submechanismIllustrationPoint); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("windDirection", exception.ParamName); + } + + [Test] + public void Constructor_ClosingSituationNull_ThrowsArgumentNullException() + { + // Setup + var windDirection = new TestWindDirection(); + var submechanismIllustrationPoint = new TestSubMechanismIllustrationPoint(); + + // Call + TestDelegate call = () => + new TopLevelSubMechanismIllustrationPoint(windDirection, null, submechanismIllustrationPoint); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("closingSituation", exception.ParamName); + } + + [Test] + public void Constructor_SubmechanismIllustationPointNull_ThrowsArgumentNullException() + { + // Setup + var windDirection = new TestWindDirection(); + + // Call + TestDelegate call = () => + new TopLevelSubMechanismIllustrationPoint(windDirection, "closing situation", null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("subMechanismIllustrationPoint", exception.ParamName); + } + + [Test] + public void Constructor_ValidArguments_ReturnsExpectedProperties() + { + // Setup + const string closingScenario = "closing scenario"; + var windDirection = new TestWindDirection(); + var submechanismIllustrationPoint = new TestSubMechanismIllustrationPoint(); + + // Call + var windDirectionClosingScenarioIllustrationPoint = + new TopLevelSubMechanismIllustrationPoint(windDirection, closingScenario, submechanismIllustrationPoint); + + // Assert + Assert.AreEqual(closingScenario, windDirectionClosingScenarioIllustrationPoint.ClosingSituation); + Assert.AreSame(windDirection, windDirectionClosingScenarioIllustrationPoint.WindDirection); + Assert.AreSame(submechanismIllustrationPoint, windDirectionClosingScenarioIllustrationPoint.SubMechanismIllustrationPoint); + } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/TopLevelSubmechanismIllustrationPointTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj =================================================================== diff -u -r283b0f6d5193b01c12b32a50919e7e88db5cfcf1 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 283b0f6d5193b01c12b32a50919e7e88db5cfcf1) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -81,10 +81,10 @@ - - + + - + Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestGeneralResultTest.cs =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestGeneralResultTest.cs (.../TestGeneralResultTest.cs) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestGeneralResultTest.cs (.../TestGeneralResultTest.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -38,7 +38,7 @@ Assert.IsInstanceOf(generalResult); AssertWindDirection(new TestWindDirection(), generalResult.GoverningWindDirection); CollectionAssert.IsEmpty(generalResult.Stochasts); - CollectionAssert.IsEmpty(generalResult.TopLevelSubmechanismIllustrationPoints); + CollectionAssert.IsEmpty(generalResult.TopLevelSubMechanismIllustrationPoints); } private static void AssertWindDirection(WindDirection expected, WindDirection actual) Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestSubMechanismIllustrationPointTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestSubMechanismIllustrationPointTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestSubMechanismIllustrationPointTest.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,46 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; + +namespace Ringtoets.Common.Data.TestUtil.Test.IllustrationPoints +{ + [TestFixture] + public class TestSubMechanismIllustrationPointTest + { + [Test] + public void DefaultConstructor_Test() + { + // Call + var illustrationPoint = new TestSubMechanismIllustrationPoint(); + + // Assert + Assert.IsInstanceOf(illustrationPoint); + + Assert.AreEqual("Illustration Point", illustrationPoint.Name); + CollectionAssert.IsEmpty(illustrationPoint.Stochasts); + CollectionAssert.IsEmpty(illustrationPoint.IllustrationPointResults); + Assert.AreEqual(3.14, illustrationPoint.Beta, illustrationPoint.Beta.GetAccuracy()); + } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestSubmechanismIllustrationPointTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj =================================================================== diff -u -r82beae540257b0a91094838c1a020d043431a93a -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj (.../Ringtoets.Common.Data.TestUtil.Test.csproj) (revision 82beae540257b0a91094838c1a020d043431a93a) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj (.../Ringtoets.Common.Data.TestUtil.Test.csproj) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -71,7 +71,7 @@ - + Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestGeneralResult.cs =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestGeneralResult.cs (.../TestGeneralResult.cs) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestGeneralResult.cs (.../TestGeneralResult.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -35,6 +35,6 @@ public TestGeneralResult() : base(new TestWindDirection(), Enumerable.Empty(), - Enumerable.Empty()) {} + Enumerable.Empty()) {} } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestSubMechanismIllustrationPoint.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestSubMechanismIllustrationPoint.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestSubMechanismIllustrationPoint.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,38 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Linq; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; + +namespace Ringtoets.Common.Data.TestUtil.IllustrationPoints +{ + /// + /// A simple submechanism illustration point which can be used for testing. + /// + public class TestSubMechanismIllustrationPoint : SubMechanismIllustrationPoint + { + /// + /// Creates a . + /// + public TestSubMechanismIllustrationPoint() + : base("Illustration Point", Enumerable.Empty(), Enumerable.Empty(), 3.14) {} + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestSubMechanismIllustrationPointStochast.cs =================================================================== diff -u -r82beae540257b0a91094838c1a020d043431a93a -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestSubMechanismIllustrationPointStochast.cs (.../TestSubMechanismIllustrationPointStochast.cs) (revision 82beae540257b0a91094838c1a020d043431a93a) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestSubMechanismIllustrationPointStochast.cs (.../TestSubMechanismIllustrationPointStochast.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -26,7 +26,7 @@ /// /// A simple sub mechanism illustration point stochast which can be used for testing. /// - public class TestSubMechanismIllustrationPointStochast : SubmechanismIllustrationPointStochast + public class TestSubMechanismIllustrationPointStochast : SubMechanismIllustrationPointStochast { /// /// Creates a new instance of . Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestSubmechanismIllustrationPoint.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj =================================================================== diff -u -r82beae540257b0a91094838c1a020d043431a93a -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj (.../Ringtoets.Common.Data.TestUtil.csproj) (revision 82beae540257b0a91094838c1a020d043431a93a) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj (.../Ringtoets.Common.Data.TestUtil.csproj) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -58,7 +58,7 @@ - + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsStackChartDataFactoryTest.cs =================================================================== diff -u -r82beae540257b0a91094838c1a020d043431a93a -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsStackChartDataFactoryTest.cs (.../RingtoetsStackChartDataFactoryTest.cs) (revision 82beae540257b0a91094838c1a020d043431a93a) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsStackChartDataFactoryTest.cs (.../RingtoetsStackChartDataFactoryTest.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -78,15 +78,15 @@ Enumerable.Empty(), new[] { - new TopLevelSubmechanismIllustrationPoint( + new TopLevelSubMechanismIllustrationPoint( windDirection, "Regular", - new TestSubmechanismIllustrationPoint()), - new TopLevelSubmechanismIllustrationPoint( + new TestSubMechanismIllustrationPoint()), + new TopLevelSubMechanismIllustrationPoint( windDirection, "Regular", - new TestSubmechanismIllustrationPoint()), - new TopLevelSubmechanismIllustrationPoint( + new TestSubMechanismIllustrationPoint()), + new TopLevelSubMechanismIllustrationPoint( windDirection, "Regular", - new TestSubmechanismIllustrationPoint()) + new TestSubMechanismIllustrationPoint()) }); // Call @@ -115,15 +115,15 @@ Enumerable.Empty(), new[] { - new TopLevelSubmechanismIllustrationPoint( + new TopLevelSubMechanismIllustrationPoint( windDirection, closingSituationRegular, - new TestSubmechanismIllustrationPoint()), - new TopLevelSubmechanismIllustrationPoint( + new TestSubMechanismIllustrationPoint()), + new TopLevelSubMechanismIllustrationPoint( windDirection, closingSituationClosed, - new TestSubmechanismIllustrationPoint()), - new TopLevelSubmechanismIllustrationPoint( + new TestSubMechanismIllustrationPoint()), + new TopLevelSubMechanismIllustrationPoint( windDirection, closingSituationOpen, - new TestSubmechanismIllustrationPoint()) + new TestSubMechanismIllustrationPoint()) }); // Call @@ -168,9 +168,9 @@ Enumerable.Empty(), new[] { - new TopLevelSubmechanismIllustrationPoint( + new TopLevelSubMechanismIllustrationPoint( new TestWindDirection(), "Regular", - new SubmechanismIllustrationPoint("Punt 1", + new SubMechanismIllustrationPoint("Punt 1", new[] { new TestSubMechanismIllustrationPointStochast("Stochast 1", -0.9), @@ -180,9 +180,9 @@ new TestSubMechanismIllustrationPointStochast("Stochast 5", -0.099) }, Enumerable.Empty(), 1)), - new TopLevelSubmechanismIllustrationPoint( + new TopLevelSubMechanismIllustrationPoint( new TestWindDirection(), "Regular", - new SubmechanismIllustrationPoint("Punt 2", + new SubMechanismIllustrationPoint("Punt 2", new[] { new TestSubMechanismIllustrationPointStochast("Stochast 1", -0.43589), @@ -192,9 +192,9 @@ new TestSubMechanismIllustrationPointStochast("Stochast 5", -0.9) }, Enumerable.Empty(), 1)), - new TopLevelSubmechanismIllustrationPoint( + new TopLevelSubMechanismIllustrationPoint( new TestWindDirection(), "Regular", - new SubmechanismIllustrationPoint("Punt 3", + new SubMechanismIllustrationPoint("Punt 3", new[] { new TestSubMechanismIllustrationPointStochast("Stochast 1", -0.43589), Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelSubMechanismIllustrationPointPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelSubMechanismIllustrationPointPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelSubMechanismIllustrationPointPropertiesTest.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,163 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.ComponentModel; +using System.Linq; +using Core.Common.Gui.Converters; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class TopLevelSubMechanismIllustrationPointPropertiesTest + { + [Test] + public void Constructor_DefaultArgumentValues_DoesNotThrowException() + { + // Call + var properties = new TopLevelSubMechanismIllustrationPointProperties(); + + // Assert + Assert.IsInstanceOf>(properties); + } + + [Test] + [TestCase("north")] + [TestCase("some random name")] + public void ToString_WithName_ReturnsCombinationOfWindDirectionAndClosingSituation(string name) + { + // Setup + var submechanismIllustrationPoint = new SubMechanismIllustrationPoint(name, + Enumerable.Empty(), + Enumerable.Empty(), + 3); + var context = new TopLevelSubMechanismIllustrationPoint(new TestWindDirection(), "direction", submechanismIllustrationPoint); + + // Call + var hydraulicBoundaryLocationProperties = new TopLevelSubMechanismIllustrationPointProperties + { + Data = context + }; + + // Assert + Assert.AreEqual(name, hydraulicBoundaryLocationProperties.ToString()); + } + + [Test] + public void GetProperties_ValidData_ReturnsExpectedValues() + { + // Setup + var random = new Random(21); + double beta = random.NextDouble(); + var stochasts = new[] + { + new SubMechanismIllustrationPointStochast("some name", random.NextDouble(), random.NextDouble(), random.NextDouble()) + }; + var illustrationPointResults = new[] + { + new IllustrationPointResult("some description", random.NextDouble()) + }; + var submechanismIllustrationPoint = new SubMechanismIllustrationPoint("name", stochasts, illustrationPointResults, beta); + + const string closingSituation = "closingSituation"; + const string windDirectionName = "windDirection"; + var windDirection = new WindDirection(windDirectionName, 123); + + var context = new TopLevelSubMechanismIllustrationPoint(windDirection, closingSituation, submechanismIllustrationPoint); + + // Call + var properties = new TopLevelSubMechanismIllustrationPointProperties + { + Data = context + }; + + // Assert + Assert.AreEqual(windDirectionName, properties.WindDirection); + Assert.AreEqual(closingSituation, properties.ClosingSituation); + CollectionAssert.AreEqual(submechanismIllustrationPoint.Stochasts, properties.AlphaValues); + CollectionAssert.AreEqual(submechanismIllustrationPoint.Stochasts, properties.Durations); + CollectionAssert.AreEqual(submechanismIllustrationPoint.IllustrationPointResults, properties.IllustrationPointResults); + + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); + + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(7, dynamicProperties.Count); + const string miscCategory = "Misc"; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[0], + miscCategory, + "Berekende kans [1/jaar]", + "De berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[1], + miscCategory, + "Betrouwbaarheidsindex berekende kans [-]", + "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[2], + miscCategory, + "Windrichting", + "De windrichting waarvoor dit illlustratiepunt is berekend.", + true); + + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[3], + miscCategory, + "Sluitscenario", + "Het sluitscenario waarvoor dit illustratiepunt is berekend.", + true); + + TestHelper.AssertTypeConverter(nameof(TopLevelSubMechanismIllustrationPointProperties.AlphaValues)); + PropertyDescriptor alphaValuesProperty = dynamicProperties[4]; + Assert.NotNull(alphaValuesProperty.Attributes[typeof(KeyValueElementAttribute)]); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphaValuesProperty, + miscCategory, + "Alfa's", + "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.", + true); + + TestHelper.AssertTypeConverter(nameof(TopLevelSubMechanismIllustrationPointProperties.Durations)); + PropertyDescriptor durationsProperty = dynamicProperties[5]; + Assert.NotNull(durationsProperty.Attributes[typeof(KeyValueElementAttribute)]); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty, + miscCategory, + "Tijdsduren", + "Tijdsduren waarop de stochasten betrekking hebben.", + true); + + TestHelper.AssertTypeConverter(nameof(TopLevelSubMechanismIllustrationPointProperties.IllustrationPointResults)); + PropertyDescriptor illustrationPointResultsProperty = dynamicProperties[6]; + Assert.NotNull(illustrationPointResultsProperty.Attributes[typeof(KeyValueElementAttribute)]); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointResultsProperty, + miscCategory, + "Waarden in het illustratiepunt", + "Realisaties van de stochasten in het illustratiepunt.", + true); + } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelSubmechanismIllustrationPointPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -re4f59b7aaaa3bf89928b516b5351ccaf66f5b08f -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision e4f59b7aaaa3bf89928b516b5351ccaf66f5b08f) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -102,7 +102,7 @@ - + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsChartControlTest.cs =================================================================== diff -u -r82beae540257b0a91094838c1a020d043431a93a -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsChartControlTest.cs (.../IllustrationPointsChartControlTest.cs) (revision 82beae540257b0a91094838c1a020d043431a93a) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsChartControlTest.cs (.../IllustrationPointsChartControlTest.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -134,18 +134,18 @@ Enumerable.Empty(), new[] { - new TopLevelSubmechanismIllustrationPoint( + new TopLevelSubMechanismIllustrationPoint( new TestWindDirection(), "Regular", - new SubmechanismIllustrationPoint("Punt 1", + new SubMechanismIllustrationPoint("Punt 1", new[] { new TestSubMechanismIllustrationPointStochast("Stochast 3", -0.9), new TestSubMechanismIllustrationPointStochast("Stochast 4", -0.43589) }, Enumerable.Empty(), 1)), - new TopLevelSubmechanismIllustrationPoint( + new TopLevelSubMechanismIllustrationPoint( new TestWindDirection(), "Regular", - new SubmechanismIllustrationPoint("Punt 2", + new SubMechanismIllustrationPoint("Punt 2", new[] { new TestSubMechanismIllustrationPointStochast("Stochast 3", -0.43589), @@ -171,9 +171,9 @@ Enumerable.Empty(), new[] { - new TopLevelSubmechanismIllustrationPoint( + new TopLevelSubMechanismIllustrationPoint( new TestWindDirection(), "Regular", - new SubmechanismIllustrationPoint("Punt 1", + new SubMechanismIllustrationPoint("Punt 1", new[] { new TestSubMechanismIllustrationPointStochast("Stochast 1", -0.9), @@ -182,9 +182,9 @@ new TestSubMechanismIllustrationPointStochast("Stochast 4", -0.01) }, Enumerable.Empty(), 1)), - new TopLevelSubmechanismIllustrationPoint( + new TopLevelSubMechanismIllustrationPoint( new TestWindDirection(), "Regular", - new SubmechanismIllustrationPoint("Punt 2", + new SubMechanismIllustrationPoint("Punt 2", new[] { new TestSubMechanismIllustrationPointStochast("Stochast 1", -0.43589), @@ -193,9 +193,9 @@ new TestSubMechanismIllustrationPointStochast("Stochast 4", -0.02) }, Enumerable.Empty(), 1)), - new TopLevelSubmechanismIllustrationPoint( + new TopLevelSubMechanismIllustrationPoint( new TestWindDirection(), "Regular", - new SubmechanismIllustrationPoint("Punt 3", + new SubMechanismIllustrationPoint("Punt 3", new[] { new TestSubMechanismIllustrationPointStochast("Stochast 1", -0.43589), Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/GeneralResultConverterTest.cs =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/GeneralResultConverterTest.cs (.../GeneralResultConverterTest.cs) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/GeneralResultConverterTest.cs (.../GeneralResultConverterTest.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -75,12 +75,12 @@ // Assert AssertWindDirection(hydraGoverningWindDirection, generalResult.GoverningWindDirection); - CollectionAssert.IsEmpty(generalResult.TopLevelSubmechanismIllustrationPoints); + CollectionAssert.IsEmpty(generalResult.TopLevelSubMechanismIllustrationPoints); CollectionAssert.IsEmpty(generalResult.Stochasts); } [Test] - public void CreateGeneralResult_HydraGeneralResultWithSubmechanismIllustrationPointsOnly_ExpectedProperties() + public void CreateGeneralResult_HydraGeneralResultWithSubMechanismIllustrationPointsOnly_ExpectedProperties() { // Setup const string closingSituation = "Closing situation"; @@ -121,15 +121,15 @@ CollectionAssert.IsEmpty(generalResult.Stochasts); - TopLevelSubmechanismIllustrationPoint combination = generalResult.TopLevelSubmechanismIllustrationPoints.Single(); + TopLevelSubMechanismIllustrationPoint combination = generalResult.TopLevelSubMechanismIllustrationPoints.Single(); AssertWindDirection(hydraWindDirection, combination.WindDirection); Assert.AreEqual(closingSituation, combination.ClosingSituation); - SubmechanismIllustrationPoint submechanismIllustrationPoint = combination.SubmechanismIllustrationPoint; - Assert.AreEqual(hydraIllustrationPoint.Name, submechanismIllustrationPoint.Name); - Assert.AreEqual(hydraIllustrationPoint.Beta, submechanismIllustrationPoint.Beta, submechanismIllustrationPoint.Beta.GetAccuracy()); - CollectionAssert.IsEmpty(submechanismIllustrationPoint.Stochasts); - CollectionAssert.IsEmpty(submechanismIllustrationPoint.IllustrationPointResults); + SubMechanismIllustrationPoint subMechanismIllustrationPoint = combination.SubMechanismIllustrationPoint; + Assert.AreEqual(hydraIllustrationPoint.Name, subMechanismIllustrationPoint.Name); + Assert.AreEqual(hydraIllustrationPoint.Beta, subMechanismIllustrationPoint.Beta, subMechanismIllustrationPoint.Beta.GetAccuracy()); + CollectionAssert.IsEmpty(subMechanismIllustrationPoint.Stochasts); + CollectionAssert.IsEmpty(subMechanismIllustrationPoint.IllustrationPointResults); } [Test] @@ -170,7 +170,7 @@ WindDirection generalResultGoverningWindDirection = generalResult.GoverningWindDirection; AssertWindDirection(governingHydraWindDirection, generalResultGoverningWindDirection); CollectionAssert.IsEmpty(generalResult.Stochasts); - CollectionAssert.IsEmpty(generalResult.TopLevelSubmechanismIllustrationPoints); + CollectionAssert.IsEmpty(generalResult.TopLevelSubMechanismIllustrationPoints); } private static void AssertWindDirection(HydraWindDirection hydraWindDirection, WindDirection windDirection) Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/StochastConverterTest.cs =================================================================== diff -u -r05f9fe5ade771d5cda22d8b1b5b4e451b2b11f6a -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/StochastConverterTest.cs (.../StochastConverterTest.cs) (revision 05f9fe5ade771d5cda22d8b1b5b4e451b2b11f6a) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/StochastConverterTest.cs (.../StochastConverterTest.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -64,18 +64,18 @@ } [Test] - public void CreateSubmechanismIllustrationStochast_HydraSubmechanismIllustrationPointStochastNull_ThrowsArgumentNullException() + public void CreateSubMechanismIllustrationStochast_HydraSubMechanismIllustrationPointStochastNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => StochastConverter.CreateSubmechanismIllustrationStochast(null); + TestDelegate call = () => StochastConverter.CreateSubMechanismIllustrationStochast(null); // Assert string paramName = Assert.Throws(call).ParamName; Assert.AreEqual("hydraSubmechanismIllustrationPointStochast", paramName); } [Test] - public void CreateSubmechanismIllustrationStochast_ValidArguments_ExpectedProperties() + public void CreateSubMechanismIllustrationStochast_ValidArguments_ExpectedProperties() { // Setup const string name = "name"; @@ -88,7 +88,7 @@ var hydraStochast = new HydraSubmechanismIllustrationPointStochast(name, duration, alpha, realization); // Call - SubmechanismIllustrationPointStochast stochast = StochastConverter.CreateSubmechanismIllustrationStochast(hydraStochast); + SubMechanismIllustrationPointStochast stochast = StochastConverter.CreateSubMechanismIllustrationStochast(hydraStochast); // Assert Assert.AreEqual(hydraStochast.Alpha, stochast.Alpha, stochast.Alpha.GetAccuracy()); Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/SubMechanismIllustrationPointConverterTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/SubMechanismIllustrationPointConverterTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/SubMechanismIllustrationPointConverterTest.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,91 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Linq; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Service.IllustrationPoints; +using HydraIllustrationPointResult = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.IllustrationPointResult; +using HydraSubmechanismIllustrationPointStochast = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.SubmechanismIllustrationPointStochast; +using HydraSubMechanismIllustrationPoint = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.SubmechanismIllustrationPoint; + +namespace Ringtoets.Common.Service.Test.IllustrationPoints +{ + [TestFixture] + public class SubMechanismIllustrationPointConverterTest + { + [Test] + public void CreateCreateIllustrationPoint_SubMechanismIllustrationPointNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => SubMechanismIllustrationPointConverter.CreateSubMechanismIllustrationPoint(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("subMechanismIllustrationPoint", paramName); + } + + [Test] + public void CreateIllustrationPoint_ValidArguments_ExpectedProperties() + { + // Setup + var random = new Random(21); + var hydraIllustrationPointResult = new HydraIllustrationPointResult("HydraIllustrationPointResult", + random.NextDouble()); + + const string name = "hydraSubmechanismIllustrationPointStochast"; + double alpha = random.NextDouble(); + double duration = random.NextDouble(); + double realization = random.NextDouble(); + var hydraSubmechanismIllustrationPointStochast = + new HydraSubmechanismIllustrationPointStochast(name, duration, alpha, realization); + + double beta = random.NextDouble(); + var hydraSubMechanismIllustrationPoint = new HydraSubMechanismIllustrationPoint("name", new[] + { + hydraSubmechanismIllustrationPointStochast + }, new[] + { + hydraIllustrationPointResult + }, beta); + + // Call + SubMechanismIllustrationPoint subMechanismIllustrationPoint = + SubMechanismIllustrationPointConverter.CreateSubMechanismIllustrationPoint(hydraSubMechanismIllustrationPoint); + + // Assert + Assert.AreEqual(subMechanismIllustrationPoint.Beta, subMechanismIllustrationPoint.Beta, subMechanismIllustrationPoint.Beta.GetAccuracy()); + Assert.AreEqual(subMechanismIllustrationPoint.Name, subMechanismIllustrationPoint.Name); + + IllustrationPointResult illustrationPointResult = subMechanismIllustrationPoint.IllustrationPointResults.Single(); + Assert.AreEqual(hydraIllustrationPointResult.Description, illustrationPointResult.Description); + Assert.AreEqual(hydraIllustrationPointResult.Value, illustrationPointResult.Value, illustrationPointResult.Value.GetAccuracy()); + + SubMechanismIllustrationPointStochast stochast = subMechanismIllustrationPoint.Stochasts.Single(); + Assert.AreEqual(hydraSubmechanismIllustrationPointStochast.Alpha, stochast.Alpha, stochast.Alpha.GetAccuracy()); + Assert.AreEqual(duration, stochast.Duration, stochast.Duration.GetAccuracy()); + Assert.AreEqual(hydraSubmechanismIllustrationPointStochast.Name, stochast.Name); + Assert.AreEqual(hydraSubmechanismIllustrationPointStochast.Realization, stochast.Realization, stochast.Realization.GetAccuracy()); + } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/SubmechanismIllustrationPointConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/TopLevelSubMechanismIllustrationPointConverterTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/TopLevelSubMechanismIllustrationPointConverterTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/TopLevelSubMechanismIllustrationPointConverterTest.cs (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -0,0 +1,135 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Linq; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Service.IllustrationPoints; +using HydraWindDirection = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.WindDirection; +using HydraWindDirectionClosingSituation = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.WindDirectionClosingSituation; +using HydraIllustrationPointResult = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.IllustrationPointResult; +using HydraRingTestWindDirection = Ringtoets.HydraRing.Calculation.TestUtil.IllustrationPoints.TestWindDirection; +using HydraSubmechanismIllustrationPointStochast = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.SubmechanismIllustrationPointStochast; +using HydraSubmechanismIllustrationPoint = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.SubmechanismIllustrationPoint; + +namespace Ringtoets.Common.Service.Test.IllustrationPoints +{ + [TestFixture] + public class TopLevelSubMechanismIllustrationPointConverterTest + { + [Test] + public void CreateTopLevelSubMechanismIllustrationPoint_HydraWindDirectionNull_ThrowsArgumentNullException() + { + // Setup + var hydraSubMechanismIllustrationPoint = + new HydraSubmechanismIllustrationPoint("name", + Enumerable.Empty(), + Enumerable.Empty(), + double.NaN); + + // Call + TestDelegate call = () => + TopLevelSubMechanismIllustrationPointConverter.CreateTopLevelSubMechanismIllustrationPoint( + null, hydraSubMechanismIllustrationPoint); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("hydraWindDirectionClosingSituation", paramName); + } + + [Test] + public void CreateTopLevelSubMechanismIllustrationPoint_SubMechanismIllustrationPointNull_ThrowsArgumentNullException() + { + // Setup + var hydraWindDirection = new HydraRingTestWindDirection(); + + // Call + TestDelegate call = () => + TopLevelSubMechanismIllustrationPointConverter.CreateTopLevelSubMechanismIllustrationPoint( + new HydraWindDirectionClosingSituation(hydraWindDirection, string.Empty), + null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("hydraSubmechanismIllustrationPoint", paramName); + } + + [Test] + public void CreateTopLevelSubMechanismIllustrationPoint_ValidArguments_ExpectedProperties() + { + // Setup + const string closingScenario = "closing scenario"; + + var random = new Random(21); + double angle = random.NextDouble(); + var hydraWindDirection = new HydraWindDirection("Name", angle); + + var windDirectionClosingSituation = new HydraWindDirectionClosingSituation(hydraWindDirection, closingScenario); + + var hydraIllustrationPointResult = new HydraIllustrationPointResult("HydraIllustrationPointResult", + random.NextDouble()); + + const string name = "HydraSubmechanismIllustrationPointStochast"; + double alpha = random.NextDouble(); + double duration = random.NextDouble(); + double realization = random.NextDouble(); + var hydraSubmechanismIllustrationPointStochast = + new HydraSubmechanismIllustrationPointStochast(name, duration, alpha, realization); + + double beta = random.NextDouble(); + var hydraSubmechanismIllustrationPoint = new HydraSubmechanismIllustrationPoint("name", new[] + { + hydraSubmechanismIllustrationPointStochast + }, new[] + { + hydraIllustrationPointResult + }, beta); + + // Call + TopLevelSubMechanismIllustrationPoint combination = + TopLevelSubMechanismIllustrationPointConverter.CreateTopLevelSubMechanismIllustrationPoint( + windDirectionClosingSituation, hydraSubmechanismIllustrationPoint); + + // Assert + WindDirection windDirection = combination.WindDirection; + Assert.AreEqual(hydraWindDirection.Angle, windDirection.Angle, windDirection.Angle.GetAccuracy()); + Assert.AreEqual(hydraWindDirection.Name, windDirection.Name); + + Assert.AreEqual(closingScenario, combination.ClosingSituation); + + SubMechanismIllustrationPoint subMechanismIllustrationPoint = combination.SubMechanismIllustrationPoint; + Assert.AreEqual(hydraSubmechanismIllustrationPoint.Beta, subMechanismIllustrationPoint.Beta, subMechanismIllustrationPoint.Beta.GetAccuracy()); + Assert.AreEqual(hydraSubmechanismIllustrationPoint.Name, subMechanismIllustrationPoint.Name); + + IllustrationPointResult illustrationPointResult = subMechanismIllustrationPoint.IllustrationPointResults.Single(); + Assert.AreEqual(hydraIllustrationPointResult.Description, illustrationPointResult.Description); + Assert.AreEqual(hydraIllustrationPointResult.Value, illustrationPointResult.Value, illustrationPointResult.Value.GetAccuracy()); + + SubMechanismIllustrationPointStochast stochast = subMechanismIllustrationPoint.Stochasts.Single(); + Assert.AreEqual(hydraSubmechanismIllustrationPointStochast.Alpha, stochast.Alpha, stochast.Alpha.GetAccuracy()); + Assert.AreEqual(hydraSubmechanismIllustrationPointStochast.Duration, stochast.Duration, stochast.Duration.GetAccuracy()); + Assert.AreEqual(hydraSubmechanismIllustrationPointStochast.Name, stochast.Name); + Assert.AreEqual(hydraSubmechanismIllustrationPointStochast.Realization, stochast.Realization, stochast.Realization.GetAccuracy()); + } + } +} \ No newline at end of file Fisheye: Tag 6a60e0e3f676c71e253ad41839519c18dd641e9e refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/TopLevelSubmechanismIllustrationPointConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/Ringtoets.Common.Service.Test.csproj =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/Ringtoets.Common.Service.Test.csproj (.../Ringtoets.Common.Service.Test.csproj) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/Ringtoets.Common.Service.Test.csproj (.../Ringtoets.Common.Service.Test.csproj) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -66,10 +66,10 @@ - + - + Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.cs =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.cs (.../GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.cs) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.cs (.../GrassCoverErosionOutwardsHydraulicBoundaryLocationContextProperties.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -157,13 +157,13 @@ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_IllustrationPoints_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_IllustrationPoints_Description))] [TypeConverter(typeof(ExpandableArrayConverter))] - public IEnumerable IllustrationPoints + public IEnumerable IllustrationPoints { get { return GetGeneralIllustrationPointsResult() - .TopLevelSubmechanismIllustrationPoints - .Select(p => new TopLevelSubmechanismIllustrationPointProperties + .TopLevelSubMechanismIllustrationPoints + .Select(p => new TopLevelSubMechanismIllustrationPointProperties { Data = p }) Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationContextPropertiesTest.cs =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationContextPropertiesTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationContextPropertiesTest.cs) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationContextPropertiesTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationContextPropertiesTest.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -126,7 +126,7 @@ var illustrationPoints = new[] { - new TopLevelSubmechanismIllustrationPoint(new WindDirection("WEST", 4), "sluit", new TestSubmechanismIllustrationPoint()), + new TopLevelSubMechanismIllustrationPoint(new WindDirection("WEST", 4), "sluit", new TestSubMechanismIllustrationPoint()), }; var stochasts = new[] { Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsWaveHeightLocationContextPropertiesTest.cs =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsWaveHeightLocationContextPropertiesTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationContextPropertiesTest.cs) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsWaveHeightLocationContextPropertiesTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationContextPropertiesTest.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -126,7 +126,7 @@ var illustrationPoints = new[] { - new TopLevelSubmechanismIllustrationPoint(new WindDirection("WEST", 4), "sluit", new TestSubmechanismIllustrationPoint()), + new TopLevelSubMechanismIllustrationPoint(new WindDirection("WEST", 4), "sluit", new TestSubMechanismIllustrationPoint()), }; var stochasts = new[] { Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -192,13 +192,13 @@ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_IllustrationPoints_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_IllustrationPoints_Description))] [TypeConverter(typeof(ExpandableArrayConverter))] - public IEnumerable IllustrationPoints + public IEnumerable IllustrationPoints { get { return GetGeneralIllustrationPointsResult() - .TopLevelSubmechanismIllustrationPoints - .Select(p => new TopLevelSubmechanismIllustrationPointProperties + .TopLevelSubMechanismIllustrationPoints + .Select(p => new TopLevelSubMechanismIllustrationPointProperties { Data = p }) Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationContextPropertiesTest.cs =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationContextPropertiesTest.cs (.../DesignWaterLevelLocationContextPropertiesTest.cs) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationContextPropertiesTest.cs (.../DesignWaterLevelLocationContextPropertiesTest.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -130,7 +130,7 @@ var illustrationPoints = new[] { - new TopLevelSubmechanismIllustrationPoint(new WindDirection("WEST", 4), "sluit", new TestSubmechanismIllustrationPoint()), + new TopLevelSubMechanismIllustrationPoint(new WindDirection("WEST", 4), "sluit", new TestSubMechanismIllustrationPoint()), }; var stochasts = new[] { Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationContextPropertiesTest.cs =================================================================== diff -u -reb404dacf85af00969cfd2b64da6e630b2c49ba4 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationContextPropertiesTest.cs (.../WaveHeightLocationContextPropertiesTest.cs) (revision eb404dacf85af00969cfd2b64da6e630b2c49ba4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationContextPropertiesTest.cs (.../WaveHeightLocationContextPropertiesTest.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -133,7 +133,7 @@ var illustrationPoints = new[] { - new TopLevelSubmechanismIllustrationPoint(new WindDirection("WEST", 4), "sluit", new TestSubmechanismIllustrationPoint()), + new TopLevelSubMechanismIllustrationPoint(new WindDirection("WEST", 4), "sluit", new TestSubMechanismIllustrationPoint()), }; var stochasts = new[] { Index: build/DatabaseStructure.sql =================================================================== diff -u -r54242411470f330f6f4c75d1d05bfd0911706873 -r6a60e0e3f676c71e253ad41839519c18dd641e9e --- build/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision 54242411470f330f6f4c75d1d05bfd0911706873) +++ build/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) @@ -1,6 +1,6 @@ /* ---------------------------------------------------- */ /* Generated by Enterprise Architect Version 12.0 */ -/* Created On : 30-Jun-2017 15:41:39 */ +/* Created On : 03-Jul-2017 13:29:29 */ /* DBMS : SQLite */ /* ---------------------------------------------------- */ @@ -219,10 +219,10 @@ DROP TABLE IF EXISTS 'GrassCoverErosionInwardsOvertoppingRateOutputEntity' ; -DROP TABLE IF EXISTS 'GeneralResultSubmechanismIllustrationPointEntity' +DROP TABLE IF EXISTS 'GeneralResultSubMechanismIllustrationPointEntity' ; -DROP TABLE IF EXISTS 'SubmechanismIllustrationPointEntity' +DROP TABLE IF EXISTS 'SubMechanismIllustrationPointEntity' ; DROP TABLE IF EXISTS 'IllustrationPointResultEntity' @@ -231,13 +231,13 @@ DROP TABLE IF EXISTS 'StochastEntity' ; -DROP TABLE IF EXISTS 'GeneralResultSubmechanismIllustrationPointStochastEntity' +DROP TABLE IF EXISTS 'GeneralResultSubMechanismIllustrationPointStochastEntity' ; -DROP TABLE IF EXISTS 'TopLevelSubmechanismIllustrationPointEntity' +DROP TABLE IF EXISTS 'TopLevelSubMechanismIllustrationPointEntity' ; -DROP TABLE IF EXISTS 'SubmechanismIllustrationPointStochastEntity' +DROP TABLE IF EXISTS 'SubMechanismIllustrationPointStochastEntity' ; /* Create Tables with Primary and Foreign Keys, Check and Unique Constraints */ @@ -1344,15 +1344,15 @@ ( 'HydraulicLocationEntityOutputId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'HydraulicLocationEntityId' INTEGER NOT NULL, - 'GeneralResultSubmechanismIllustrationPointEntityId' INTEGER, + 'GeneralResultSubMechanismIllustrationPointEntityId' INTEGER, 'HydraulicLocationOutputType' TINYINT (1) NOT NULL, -- Enum: 1 = DesignWaterLevel, 2 = WaveHeight 'Result' REAL, 'TargetProbability' REAL, 'TargetReliability' REAL, 'CalculatedProbability' REAL, 'CalculatedReliability' REAL, 'CalculationConvergence' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = CalculatedNotConverged, 3 = CalculatedConverged - CONSTRAINT 'FK_HydraulicLocationOutputEntity_GeneralResultSubMechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubmechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubmechanismIllustrationPointEntity' ('GeneralResultSubmechanismIllustrationPointEntityId') ON DELETE No Action ON UPDATE No Action, + CONSTRAINT 'FK_HydraulicLocationOutputEntity_GeneralResultSubMechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubMechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubMechanismIllustrationPointEntity' ('GeneralResultSubMechanismIllustrationPointEntityId') ON DELETE No Action ON UPDATE No Action, CONSTRAINT 'FK_HydraulicLocationOutputEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') ON DELETE Cascade ON UPDATE Cascade, CONSTRAINT 'U_HydraulicLocationEntityOutputType' UNIQUE ('HydraulicLocationEntityId','HydraulicLocationOutputType') ) @@ -1362,15 +1362,15 @@ ( 'GrassCoverErosionOutwardsHydraulicLocationOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'GrassCoverErosionOutwardsHydraulicLocationEntityId' INTEGER NOT NULL, - 'GeneralResultSubmechanismIllustrationPointEntityId' INTEGER, + 'GeneralResultSubMechanismIllustrationPointEntityId' INTEGER, 'HydraulicLocationOutputType' TINYINT (1) NOT NULL, -- Enum: 1 = DesignWaterLevel, 2 = WaveHeight 'Result' REAL, 'TargetProbability' REAL, 'TargetReliability' REAL, 'CalculatedProbability' REAL, 'CalculatedReliability' REAL, 'CalculationConvergence' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = CalculatedNotConverged, 3 = CalculatedConverged - CONSTRAINT 'FK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GeneralResultSubMechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubmechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubmechanismIllustrationPointEntity' ('GeneralResultSubmechanismIllustrationPointEntityId') ON DELETE No Action ON UPDATE No Action, + CONSTRAINT 'FK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GeneralResultSubMechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubMechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubMechanismIllustrationPointEntity' ('GeneralResultSubMechanismIllustrationPointEntityId') ON DELETE No Action ON UPDATE No Action, CONSTRAINT 'FK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GrassCoverErosionOutwardsHydraulicLocationEntity' FOREIGN KEY ('GrassCoverErosionOutwardsHydraulicLocationEntityId') REFERENCES 'GrassCoverErosionOutwardsHydraulicLocationEntity' ('GrassCoverErosionOutwardsHydraulicLocationEntityId') ON DELETE Cascade ON UPDATE Cascade, CONSTRAINT 'U_HydraulicLocationOutputType' UNIQUE ('GrassCoverErosionOutwardsHydraulicLocationEntityId','HydraulicLocationOutputType') ) @@ -1447,17 +1447,17 @@ ) ; -CREATE TABLE 'GeneralResultSubmechanismIllustrationPointEntity' +CREATE TABLE 'GeneralResultSubMechanismIllustrationPointEntity' ( - 'GeneralResultSubmechanismIllustrationPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + 'GeneralResultSubMechanismIllustrationPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'GoverningWindDirectionName' TEXT NOT NULL, 'GoverningWindDirectionAngle' REAL NOT NULL ) ; -CREATE TABLE 'SubmechanismIllustrationPointEntity' +CREATE TABLE 'SubMechanismIllustrationPointEntity' ( - 'SubmechanismIllustrationPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + 'SubMechanismIllustrationPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'Name' TEXT NOT NULL, 'Beta' REAL NOT NULL, 'Order' INT (4) NOT NULL @@ -1467,11 +1467,11 @@ CREATE TABLE 'IllustrationPointResultEntity' ( 'IllustrationPointResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - 'SubmechanismIllustrationPointEntityId' INTEGER NOT NULL, + 'SubMechanismIllustrationPointEntityId' INTEGER NOT NULL, 'Description' TEXT NOT NULL, 'Value' REAL NOT NULL, 'Order' INT (4) NOT NULL, - CONSTRAINT 'FK_IllustrationPointResultEntity_SubmechanismIllustrationPointEntity' FOREIGN KEY ('SubmechanismIllustrationPointEntityId') REFERENCES 'SubmechanismIllustrationPointEntity' ('SubmechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade + CONSTRAINT 'FK_IllustrationPointResultEntity_SubMechanismIllustrationPointEntity' FOREIGN KEY ('SubMechanismIllustrationPointEntityId') REFERENCES 'SubMechanismIllustrationPointEntity' ('SubMechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade ) ; @@ -1485,41 +1485,41 @@ ) ; -CREATE TABLE 'GeneralResultSubmechanismIllustrationPointStochastEntity' +CREATE TABLE 'GeneralResultSubMechanismIllustrationPointStochastEntity' ( - 'GeneralResultSubmechanismIllustrationPointEntityId' INTEGER NOT NULL, + 'GeneralResultSubMechanismIllustrationPointEntityId' INTEGER NOT NULL, 'StochastEntityId' INTEGER NOT NULL, - CONSTRAINT 'PK_GeneralResultSubmechanismIllustrationPointStochastEntity' PRIMARY KEY ('GeneralResultSubmechanismIllustrationPointEntityId','StochastEntityId'), - CONSTRAINT 'FK_GeneralResultSubmechanisIllustrationPointStochastEntity_GeneralResultSubmechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubmechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubmechanismIllustrationPointEntity' ('GeneralResultSubmechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade, - CONSTRAINT 'FK_GeneralResultSubmechanismIllustrationPointStochastEntity_StochastEntity' FOREIGN KEY ('StochastEntityId') REFERENCES 'StochastEntity' ('StochastEntityId') ON DELETE No Action ON UPDATE No Action + CONSTRAINT 'PK_GeneralResultSubMechanismIllustrationPointStochastEntity' PRIMARY KEY ('GeneralResultSubMechanismIllustrationPointEntityId','StochastEntityId'), + CONSTRAINT 'FK_GeneralResultSubMechanisIllustrationPointStochastEntity_GeneralResultSubMechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubMechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubMechanismIllustrationPointEntity' ('GeneralResultSubMechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade, + CONSTRAINT 'FK_GeneralResultSubMechanismIllustrationPointStochastEntity_StochastEntity' FOREIGN KEY ('StochastEntityId') REFERENCES 'StochastEntity' ('StochastEntityId') ON DELETE No Action ON UPDATE No Action ) ; -CREATE TABLE 'TopLevelSubmechanismIllustrationPointEntity' +CREATE TABLE 'TopLevelSubMechanismIllustrationPointEntity' ( - 'TopLevelSubmechanismIllustrationPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - 'GeneralResultSubmechanismIllustrationPointEntityId' INTEGER NOT NULL, - 'SubmechanismIllustrationPointEntityId' INTEGER NOT NULL, + 'TopLevelSubMechanismIllustrationPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + 'GeneralResultSubMechanismIllustrationPointEntityId' INTEGER NOT NULL, + 'SubMechanismIllustrationPointEntityId' INTEGER NOT NULL, 'ClosingSituation' TEXT NOT NULL, 'WindDirectionName' TEXT NOT NULL, 'WindDirectionAngle' REAL NOT NULL, 'Beta' REAL NOT NULL, 'Order' INT (4) NOT NULL, - CONSTRAINT 'FK_TopLevelSubmechanismIllustrationPointEntity_GeneralResultSubmechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubmechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubmechanismIllustrationPointEntity' ('GeneralResultSubmechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade, - CONSTRAINT 'FK_TopLevelSubmechanismIllustrationPointEntity_SubmechanismIllustrationPointEntity' FOREIGN KEY ('SubmechanismIllustrationPointEntityId') REFERENCES 'SubmechanismIllustrationPointEntity' ('SubmechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade + CONSTRAINT 'FK_TopLevelSubMechanismIllustrationPointEntity_GeneralResultSubMechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubMechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubMechanismIllustrationPointEntity' ('GeneralResultSubMechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade, + CONSTRAINT 'FK_TopLevelSubMechanismIllustrationPointEntity_SubMechanismIllustrationPointEntity' FOREIGN KEY ('SubMechanismIllustrationPointEntityId') REFERENCES 'SubMechanismIllustrationPointEntity' ('SubMechanismIllustrationPointEntityId') ON DELETE Cascade ON UPDATE Cascade ) ; -CREATE TABLE 'SubmechanismIllustrationPointStochastEntity' +CREATE TABLE 'SubMechanismIllustrationPointStochastEntity' ( - 'SubmechanismIllustrationPointStochastEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - 'SubmechanismIllustrationPointEntityId' INTEGER NOT NULL, + 'SubMechanismIllustrationPointStochastEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + 'SubMechanismIllustrationPointEntityId' INTEGER NOT NULL, 'Name' TEXT NOT NULL, 'Duration' REAL NOT NULL, 'Alpha' REAL NOT NULL, 'Realization' REAL NOT NULL, 'Order' INT (4) NOT NULL, - CONSTRAINT 'FK_SubmechanismIllustrationPointStochast_SubmechanismIllustrationPointEntity' FOREIGN KEY ('SubmechanismIllustrationPointEntityId') REFERENCES 'SubmechanismIllustrationPointEntity' ('SubmechanismIllustrationPointEntityId') ON DELETE No Action ON UPDATE No Action + CONSTRAINT 'FK_SubMechanismIllustrationPointStochast_SubMechanismIllustrationPointEntity' FOREIGN KEY ('SubMechanismIllustrationPointEntityId') REFERENCES 'SubMechanismIllustrationPointEntity' ('SubMechanismIllustrationPointEntityId') ON DELETE No Action ON UPDATE No Action ) ; @@ -1870,38 +1870,38 @@ ; CREATE INDEX 'IXFK_HydraulicLocationOutputEntity_GeneralResultSubMechanismIllustrationPointEntity' - ON 'HydraulicLocationOutputEntity' ('GeneralResultSubmechanismIllustrationPointEntityId' ASC) + ON 'HydraulicLocationOutputEntity' ('GeneralResultSubMechanismIllustrationPointEntityId' ASC) ; CREATE INDEX 'IXFK_HydraulicLocationOutputEntity_HydraulicLocationEntity' ON 'HydraulicLocationOutputEntity' ('HydraulicLocationEntityId' ASC) ; -CREATE TRIGGER [TR_AfterDeleteHydraulicLocationOutputEntity_RemoveGeneralResultSubmechanismIllustrationPointEntity] +CREATE TRIGGER [TR_AfterDeleteHydraulicLocationOutputEntity_RemoveGeneralResultSubMechanismIllustrationPointEntity] AFTER DELETE ON HydraulicLocationOutputEntity FOR EACH ROW BEGIN - DELETE FROM GeneralResultSubmechanismIllustrationPointEntity - WHERE OLD.GeneralResultSubmechanismIllustrationPointEntityId IS NOT NULL AND - GeneralResultSubmechanismIllustrationPointEntityId IS OLD.GeneralResultSubmechanismIllustrationPointEntityId; + DELETE FROM GeneralResultSubMechanismIllustrationPointEntity + WHERE OLD.GeneralResultSubMechanismIllustrationPointEntityId IS NOT NULL AND + GeneralResultSubMechanismIllustrationPointEntityId IS OLD.GeneralResultSubMechanismIllustrationPointEntityId; END; ; CREATE INDEX 'IXFK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GeneralResultSubMechanismIllustrationPointEntity' - ON 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity' ('GeneralResultSubmechanismIllustrationPointEntityId' ASC) + ON 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity' ('GeneralResultSubMechanismIllustrationPointEntityId' ASC) ; CREATE INDEX 'IXFK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GrassCoverErosionOutwardsHydraulicLocationEntity' ON 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity' ('GrassCoverErosionOutwardsHydraulicLocationEntityId' ASC) ; -CREATE TRIGGER [TR_AfterDeleteGrassCoverErosionOuwardsHydraulicLocationOutputEntity_RemoveGeneralResultSubmechanismIllustrationPointEntity] +CREATE TRIGGER [TR_AfterDeleteGrassCoverErosionOuwardsHydraulicLocationOutputEntity_RemoveGeneralResultSubMechanismIllustrationPointEntity] AFTER DELETE ON GrassCoverErosionOutwardsHydraulicLocationOutputEntity FOR EACH ROW BEGIN - DELETE FROM GrassCoverErosionOutwardsHydraulicLocationOutputEntity - WHERE OLD.GrassCoverErosionOutwardsHydraulicLocationOutputEntityId IS NOT NULL AND - GrassCoverErosionOutwardsHydraulicLocationOutputEntityId IS OLD.GrassCoverErosionOutwardsHydraulicLocationOutputEntityId; + DELETE FROM GeneralResultSubMechanismIllustrationPointEntity + WHERE OLD.GeneralResultSubMechanismIllustrationPointEntityId IS NOT NULL AND + GeneralResultSubMechanismIllustrationPointEntityId IS OLD.GeneralResultSubMechanismIllustrationPointEntityId; END; ; @@ -1925,20 +1925,20 @@ ON 'GrassCoverErosionInwardsOvertoppingRateOutputEntity' ('GrassCoverErosionInwardsOutputEntityId' ASC) ; -CREATE INDEX 'IXFK_IllustrationPointResultEntity_SubmechanismIllustrationPointEntity' - ON 'IllustrationPointResultEntity' ('SubmechanismIllustrationPointEntityId' ASC) +CREATE INDEX 'IXFK_IllustrationPointResultEntity_SubMechanismIllustrationPointEntity' + ON 'IllustrationPointResultEntity' ('SubMechanismIllustrationPointEntityId' ASC) ; -CREATE INDEX 'IXFK_GeneralResultSubmechanismIllustrationPointStochastEntity_GeneralResultSubmechanismIllustrationPointEntity' - ON 'GeneralResultSubmechanismIllustrationPointStochastEntity' ('GeneralResultSubmechanismIllustrationPointEntityId' ASC) +CREATE INDEX 'IXFK_GeneralResultSubMechanismIllustrationPointStochastEntity_GeneralResultSubMechanismIllustrationPointEntity' + ON 'GeneralResultSubMechanismIllustrationPointStochastEntity' ('GeneralResultSubMechanismIllustrationPointEntityId' ASC) ; -CREATE INDEX 'IXFK_GeneralResultSubmechanismIllustrationPointStochastEntity_StochastEntity' - ON 'GeneralResultSubmechanismIllustrationPointStochastEntity' ('StochastEntityId' ASC) +CREATE INDEX 'IXFK_GeneralResultSubMechanismIllustrationPointStochastEntity_StochastEntity' + ON 'GeneralResultSubMechanismIllustrationPointStochastEntity' ('StochastEntityId' ASC) ; -CREATE TRIGGER [TR_AfterDeleteGeneralResultSubmechanismIllustrationPointStochastEntity_RemoveStochastEntity] +CREATE TRIGGER [TR_AfterDeleteGeneralResultSubMechanismIllustrationPointStochastEntity_RemoveStochastEntity] AFTER DELETE - ON GeneralResultSubmechanismIllustrationPointStochastEntity + ON GeneralResultSubMechanismIllustrationPointStochastEntity FOR EACH ROW BEGIN DELETE FROM StochastEntity @@ -1947,24 +1947,24 @@ END; ; -CREATE INDEX 'IXFK_TopLevelSubmechanismIllustrationPointEntity_GeneralResultSubmechanismIllustrationPointEntity' - ON 'TopLevelSubmechanismIllustrationPointEntity' ('GeneralResultSubmechanismIllustrationPointEntityId' ASC) +CREATE INDEX 'IXFK_TopLevelSubMechanismIllustrationPointEntity_GeneralResultSubMechanismIllustrationPointEntity' + ON 'TopLevelSubMechanismIllustrationPointEntity' ('GeneralResultSubMechanismIllustrationPointEntityId' ASC) ; -CREATE INDEX 'IXFK_TopLevelSubmechanismIllustrationPointEntity_SubmechanismIllustrationPointEntity' - ON 'TopLevelSubmechanismIllustrationPointEntity' ('SubmechanismIllustrationPointEntityId' ASC) +CREATE INDEX 'IXFK_TopLevelSubMechanismIllustrationPointEntity_SubMechanismIllustrationPointEntity' + ON 'TopLevelSubMechanismIllustrationPointEntity' ('SubMechanismIllustrationPointEntityId' ASC) ; -CREATE TRIGGER [TR_AfterDeleteTopLevelSubmechanismIllustrationPointEntity_RemoveSubmechanismIllustrationPointEntity] +CREATE TRIGGER [TR_AfterDeleteTopLevelSubMechanismIllustrationPointEntity_RemoveSubMechanismIllustrationPointEntity] AFTER DELETE - ON TopLevelSubmechanismIllustrationPointEntity + ON TopLevelSubMechanismIllustrationPointEntity FOR EACH ROW BEGIN - DELETE FROM SubmechanismIllustrationPointEntity - WHERE OLD.SubmechanismIllustrationPointEntityId IS NOT NULL AND - SubmechanismIllustrationPointEntityId IS OLD.SubmechanismIllustrationPointEntityId; + DELETE FROM SubMechanismIllustrationPointEntity + WHERE OLD.SubMechanismIllustrationPointEntityId IS NOT NULL AND + SubMechanismIllustrationPointEntityId IS OLD.SubMechanismIllustrationPointEntityId; END; ; -CREATE INDEX 'IXFK_SubmechanismIllustrationPointStochast_SubmechanismIllustrationPointEntity' - ON 'SubmechanismIllustrationPointStochastEntity' ('SubmechanismIllustrationPointEntityId' ASC) +CREATE INDEX 'IXFK_SubMechanismIllustrationPointStochast_SubMechanismIllustrationPointEntity' + ON 'SubMechanismIllustrationPointStochastEntity' ('SubMechanismIllustrationPointEntityId' ASC) ; Index: design/DatabaseDesign.eap =================================================================== diff -u -r54242411470f330f6f4c75d1d05bfd0911706873 -r6a60e0e3f676c71e253ad41839519c18dd641e9e Binary files differ