Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingSoilProfileCreateExtensions.cs =================================================================== diff -u -ra096cb901099c85dbaafa2dba6c69288464c248e -rd78f01e3de6c12c9982dbd25b8693ab374bee32f --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingSoilProfileCreateExtensions.cs (.../PipingSoilProfileCreateExtensions.cs) (revision a096cb901099c85dbaafa2dba6c69288464c248e) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingSoilProfileCreateExtensions.cs (.../PipingSoilProfileCreateExtensions.cs) (revision d78f01e3de6c12c9982dbd25b8693ab374bee32f) @@ -54,7 +54,8 @@ var entity = new PipingSoilProfileEntity { Name = profile.Name.DeepClone(), - Bottom = profile.Bottom.ToNaNAsNull() + Bottom = profile.Bottom.ToNaNAsNull(), + SourceType = Convert.ToByte(profile.SoilProfileSourceType) }; AddEntitiesForPipingSoilLayers(profile, entity); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingSoilProfileCreateExtensionsTest.cs =================================================================== diff -u -re08b5ce64ea11d4f631c96acf8c7bf7f33865f78 -rd78f01e3de6c12c9982dbd25b8693ab374bee32f --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingSoilProfileCreateExtensionsTest.cs (.../PipingSoilProfileCreateExtensionsTest.cs) (revision e08b5ce64ea11d4f631c96acf8c7bf7f33865f78) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingSoilProfileCreateExtensionsTest.cs (.../PipingSoilProfileCreateExtensionsTest.cs) (revision d78f01e3de6c12c9982dbd25b8693ab374bee32f) @@ -51,14 +51,17 @@ public void Create_WithCollectorAndLayers_ReturnsPipingSoilProfileEntityWithPropertiesAndPipingSoilLayerEntitiesSet() { // Setup + var random = new Random(21); + const string testName = "testName"; - double bottom = new Random(21).NextDouble(); + double bottom = random.NextDouble(); var layers = new[] { new PipingSoilLayer(bottom + 1), new PipingSoilLayer(bottom + 2) }; - var soilProfile = new PipingSoilProfile(testName, bottom, layers, SoilProfileType.SoilProfile1D); + var soilProfileType = random.NextEnumValue(); + var soilProfile = new PipingSoilProfile(testName, bottom, layers, soilProfileType); var registry = new PersistenceRegistry(); // Call @@ -67,6 +70,7 @@ // Assert Assert.IsNotNull(entity); Assert.AreEqual(bottom, entity.Bottom); + Assert.AreEqual(Convert.ToByte(soilProfileType), entity.SourceType); Assert.AreEqual(testName, entity.Name); Assert.AreEqual(2, entity.PipingSoilLayerEntities.Count); } @@ -75,13 +79,14 @@ public void Create_StringPropertiesDoNotShareReference() { // Setup + var random = new Random(21); const string testName = "testName"; var layers = new[] { new PipingSoilLayer(1), new PipingSoilLayer(2) }; - var soilProfile = new PipingSoilProfile(testName, 0, layers, SoilProfileType.SoilProfile1D); + var soilProfile = new PipingSoilProfile(testName, 0, layers, random.NextEnumValue()); var registry = new PersistenceRegistry(); // Call Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingStochasticSoilProfileProperties.cs =================================================================== diff -u -rf9a399433aad5440d0d731cc96ad5d7c6bd79cf9 -rd78f01e3de6c12c9982dbd25b8693ab374bee32f --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingStochasticSoilProfileProperties.cs (.../PipingStochasticSoilProfileProperties.cs) (revision f9a399433aad5440d0d731cc96ad5d7c6bd79cf9) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingStochasticSoilProfileProperties.cs (.../PipingStochasticSoilProfileProperties.cs) (revision d78f01e3de6c12c9982dbd25b8693ab374bee32f) @@ -28,6 +28,7 @@ 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.Piping.Data.SoilProfile; using Ringtoets.Piping.Primitives; @@ -111,13 +112,12 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.StochasticSoilProfile_Type_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.StochasticSoilProfile_Type_Description))] - public string Type + [TypeConverter(typeof(EnumTypeConverter))] + public SoilProfileType Type { get { - return data.SoilProfile.SoilProfileSourceType == SoilProfileType.SoilProfile1D - ? RingtoetsCommonFormsResources.StochasticSoilProfile_Type_1D - : RingtoetsCommonFormsResources.StochasticSoilProfile_Type_2D; + return data.SoilProfile.SoilProfileSourceType; } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.Designer.cs =================================================================== diff -u -rfc7fef209ce94b913bf4bfb974abd71242b4769d -rd78f01e3de6c12c9982dbd25b8693ab374bee32f --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision fc7fef209ce94b913bf4bfb974abd71242b4769d) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d78f01e3de6c12c9982dbd25b8693ab374bee32f) @@ -98,5 +98,23 @@ return ResourceManager.GetString("PipingSoilProfile_Layers_Layer_top_below_profile_bottom", resourceCulture); } } + + /// + /// Looks up a localized string similar to 1D Profiel. + /// + public static string SoilProfileType_SoilProfile1D_DisplayName { + get { + return ResourceManager.GetString("SoilProfileType_SoilProfile1D_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 2D Profiel. + /// + public static string SoilProfileType_SoilProfile2D_DisplayName { + get { + return ResourceManager.GetString("SoilProfileType_SoilProfile2D_DisplayName", resourceCulture); + } + } } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.resx =================================================================== diff -u -rfc7fef209ce94b913bf4bfb974abd71242b4769d -rd78f01e3de6c12c9982dbd25b8693ab374bee32f --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.resx (.../Resources.resx) (revision fc7fef209ce94b913bf4bfb974abd71242b4769d) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.resx (.../Resources.resx) (revision d78f01e3de6c12c9982dbd25b8693ab374bee32f) @@ -123,4 +123,10 @@ Eén of meerdere lagen hebben een top onder de bodem van de ondergrondschematisatie. + + 1D Profiel + + + 2D Profiel + \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Ringtoets.Piping.Primitives.csproj =================================================================== diff -u -rfc7fef209ce94b913bf4bfb974abd71242b4769d -rd78f01e3de6c12c9982dbd25b8693ab374bee32f --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Ringtoets.Piping.Primitives.csproj (.../Ringtoets.Piping.Primitives.csproj) (revision fc7fef209ce94b913bf4bfb974abd71242b4769d) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Ringtoets.Piping.Primitives.csproj (.../Ringtoets.Piping.Primitives.csproj) (revision d78f01e3de6c12c9982dbd25b8693ab374bee32f) @@ -59,6 +59,11 @@ Core.Common.Base False + + {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} + Core.Common.Utils + False + {d4200f43-3f72-4f42-af0a-8ced416a38ec} Ringtoets.Common.Data Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/SoilProfileType.cs =================================================================== diff -u -r94ce658a9488c346f114446f0e37dabab7acaa38 -rd78f01e3de6c12c9982dbd25b8693ab374bee32f --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/SoilProfileType.cs (.../SoilProfileType.cs) (revision 94ce658a9488c346f114446f0e37dabab7acaa38) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/SoilProfileType.cs (.../SoilProfileType.cs) (revision d78f01e3de6c12c9982dbd25b8693ab374bee32f) @@ -19,6 +19,9 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using Core.Common.Utils.Attributes; +using Ringtoets.Piping.Primitives.Properties; + namespace Ringtoets.Piping.Primitives { /// @@ -29,11 +32,13 @@ /// /// One dimensional soil profile. /// + [ResourcesDisplayName(typeof(Resources), nameof(Resources.SoilProfileType_SoilProfile1D_DisplayName))] SoilProfile1D = 1, /// /// Two dimensional soil profile. /// + [ResourcesDisplayName(typeof(Resources), nameof(Resources.SoilProfileType_SoilProfile2D_DisplayName))] SoilProfile2D = 2 } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingStochasticSoilProfilePropertiesTest.cs =================================================================== diff -u -r6cf604a94300560817de70fd42d09baa5b22c3a6 -rd78f01e3de6c12c9982dbd25b8693ab374bee32f --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingStochasticSoilProfilePropertiesTest.cs (.../PipingStochasticSoilProfilePropertiesTest.cs) (revision 6cf604a94300560817de70fd42d09baa5b22c3a6) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingStochasticSoilProfilePropertiesTest.cs (.../PipingStochasticSoilProfilePropertiesTest.cs) (revision d78f01e3de6c12c9982dbd25b8693ab374bee32f) @@ -25,6 +25,7 @@ using Core.Common.Gui.Converters; using Core.Common.Gui.PropertyBag; using Core.Common.TestUtil; +using Core.Common.Utils; using NUnit.Framework; using Ringtoets.Piping.Data.SoilProfile; using Ringtoets.Piping.Forms.PropertyClasses; @@ -60,6 +61,8 @@ Assert.IsInstanceOf>(properties); TestHelper.AssertTypeConverter(nameof(PipingStochasticSoilProfileProperties.Layers)); + TestHelper.AssertTypeConverter(nameof(PipingStochasticSoilProfileProperties.Type)); Assert.AreSame(stochasticSoilProfile, properties.Data); } @@ -84,27 +87,6 @@ } [Test] - [TestCase(SoilProfileType.SoilProfile1D, "1D profiel")] - [TestCase(SoilProfileType.SoilProfile2D, "2D profiel")] - public void Type_WithDifferentSoilProfileTypes_ReturnsExpectedValues(SoilProfileType soilProfileType, - string expectedValue) - { - // Setup - var stochasticSoilProfile = new PipingStochasticSoilProfile(0.0, new PipingSoilProfile("", 0.0, new[] - { - new PipingSoilLayer(10.0) - }, soilProfileType)); - - var properties = new PipingStochasticSoilProfileProperties(stochasticSoilProfile); - - // Call - string typeValue = properties.Type; - - // Assert - Assert.AreEqual(expectedValue, typeValue); - } - - [Test] public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Setup @@ -160,6 +142,7 @@ private static void GetProperties_WithData_ReturnExpectedValues(double probability, string expectedProbability) { // Setup + var random = new Random(21); var layerOne = new PipingSoilLayer(-2); var layerTwo = new PipingSoilLayer(-4); @@ -169,7 +152,8 @@ layerTwo }; - var soilProfile = new PipingSoilProfile("", -5.0, layers, SoilProfileType.SoilProfile1D); + var soilProfileType = random.NextEnumValue(); + var soilProfile = new PipingSoilProfile("", -5.0, layers, soilProfileType); var stochasticSoilProfile = new PipingStochasticSoilProfile(probability, soilProfile); // Call @@ -184,6 +168,7 @@ Assert.AreEqual(soilProfile.Bottom, properties.Bottom); Assert.AreEqual(expectedProbability, properties.Probability); + Assert.AreEqual(soilProfileType, properties.Type); } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj =================================================================== diff -u -ra1fa1538918813373bcc864f0bce092bf28fd0ce -rd78f01e3de6c12c9982dbd25b8693ab374bee32f --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision a1fa1538918813373bcc864f0bce092bf28fd0ce) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision d78f01e3de6c12c9982dbd25b8693ab374bee32f) @@ -117,6 +117,10 @@ {30e4c2ae-719e-4d70-9fa9-668a9767fbfa} Core.Common.Gui + + {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} + Core.Common.Utils + {d749ee4c-ce50-4c17-bf01-9a953028c126} Core.Common.TestUtil Index: Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/Ringtoets.Piping.Primitives.Test.csproj =================================================================== diff -u -ra1fa1538918813373bcc864f0bce092bf28fd0ce -rd78f01e3de6c12c9982dbd25b8693ab374bee32f --- Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/Ringtoets.Piping.Primitives.Test.csproj (.../Ringtoets.Piping.Primitives.Test.csproj) (revision a1fa1538918813373bcc864f0bce092bf28fd0ce) +++ Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/Ringtoets.Piping.Primitives.Test.csproj (.../Ringtoets.Piping.Primitives.Test.csproj) (revision d78f01e3de6c12c9982dbd25b8693ab374bee32f) @@ -57,6 +57,7 @@ + Index: Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/SoilProfileTypeTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/SoilProfileTypeTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/SoilProfileTypeTest.cs (revision d78f01e3de6c12c9982dbd25b8693ab374bee32f) @@ -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.Collections.Generic; +using Core.Common.TestUtil; +using NUnit.Framework; + +namespace Ringtoets.Piping.Primitives.Test +{ + [TestFixture] + public class SoilProfileTypeTest : EnumTestFixture + { + protected override IDictionary ExpectedDisplayNameForEnumValues + { + get + { + return new Dictionary + { + { + SoilProfileType.SoilProfile1D, "1D Profiel" + }, + { + SoilProfileType.SoilProfile2D, "2D Profiel" + } + }; + } + } + + protected override IDictionary ExpectedValueForEnumValues + { + get + { + return new Dictionary + { + { + SoilProfileType.SoilProfile1D, 1 + }, + { + SoilProfileType.SoilProfile2D, 2 + } + }; + } + } + } +} \ No newline at end of file