Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingSoilProfileTransformer.cs =================================================================== diff -u -r48a688047e3bf0b080a13137f1197363e63c0020 -r763e4e54f2b5478ddebfc09be8c8d1da541e1a15 --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingSoilProfileTransformer.cs (.../PipingSoilProfileTransformer.cs) (revision 48a688047e3bf0b080a13137f1197363e63c0020) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingSoilProfileTransformer.cs (.../PipingSoilProfileTransformer.cs) (revision 763e4e54f2b5478ddebfc09be8c8d1da541e1a15) @@ -62,8 +62,10 @@ return CreatePipingSoilProfile(soilProfile2D); } - string message = $"Soil profile of type '{soilProfile.GetType().Name}' is not supported." + - $"Only soil profiles of type '{nameof(SoilProfile1D)}' or '{nameof(SoilProfile2D)}' are supported."; + string message = string.Format(Resources.PipingSoilProfileTransformer_Cannot_tranform_Type_0_Only_types_Type_1_and_Type_2_are_supported, + soilProfile.GetType().Name, + nameof(SoilProfile1D), + nameof(SoilProfile2D)); throw new ImportedDataTransformException(message); } @@ -85,7 +87,8 @@ if (double.IsNaN(intersectionX)) { - string message = string.Format(Resources.Error_SoilProfileBuilder_cant_determine_intersect_SoilProfileName_0_at_double_NaN, profileName); + string message = string.Format(Resources.Error_SoilProfileBuilder_cant_determine_intersect_SoilProfileName_0_at_double_NaN, + profileName); throw new ImportedDataTransformException(message); } Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingStochasticSoilModelTransformer.cs =================================================================== diff -u -re2482d49e8d3da2a393409ebcaf5b0f1ddf34a63 -r763e4e54f2b5478ddebfc09be8c8d1da541e1a15 --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingStochasticSoilModelTransformer.cs (.../PipingStochasticSoilModelTransformer.cs) (revision e2482d49e8d3da2a393409ebcaf5b0f1ddf34a63) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingStochasticSoilModelTransformer.cs (.../PipingStochasticSoilModelTransformer.cs) (revision 763e4e54f2b5478ddebfc09be8c8d1da541e1a15) @@ -25,6 +25,7 @@ using Ringtoets.Common.IO.SoilProfile; using Ringtoets.Common.IO.SoilProfile.Schema; using Ringtoets.Piping.Data.SoilProfile; +using Ringtoets.Piping.IO.Properties; using Ringtoets.Piping.Primitives; namespace Ringtoets.Piping.IO.Importers @@ -40,12 +41,14 @@ { if (stochasticSoilModel.FailureMechanismType != FailureMechanismType.Piping) { - string message = $"Stochastic soil model of failure mechanism type '{stochasticSoilModel.FailureMechanismType}' is not supported." + - $"Only stochastic soil model of failure mechanism type '{FailureMechanismType.Piping}' is supported."; + string message = string.Format(Resources.PipingStochasticSoilModelTransformer_Cannot_tranform_FailureMechanismType_0_Only_FailureMechanismType_1_supported, + stochasticSoilModel.FailureMechanismType, + FailureMechanismType.Piping); throw new ImportedDataTransformException(message); } - IEnumerable pipingStochasticSoilProfiles = TransformStochasticSoilProfiles(stochasticSoilModel.StochasticSoilProfiles); + IEnumerable pipingStochasticSoilProfiles = TransformStochasticSoilProfiles( + stochasticSoilModel.StochasticSoilProfiles); var pipingModel = new PipingStochasticSoilModel(stochasticSoilModel.Name); pipingModel.Geometry.AddRange(stochasticSoilModel.Geometry); Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs =================================================================== diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -r763e4e54f2b5478ddebfc09be8c8d1da541e1a15 --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 763e4e54f2b5478ddebfc09be8c8d1da541e1a15) @@ -244,6 +244,26 @@ } /// + /// Looks up a localized string similar to De ondergrondschematisatie van het type '{0}' is niet ondersteund. Alleen ondergrondschematisaties van het type '{1}' of '{2}' zijn ondersteund.. + /// + public static string PipingSoilProfileTransformer_Cannot_tranform_Type_0_Only_types_Type_1_and_Type_2_are_supported { + get { + return ResourceManager.GetString("PipingSoilProfileTransformer_Cannot_tranform_Type_0_Only_types_Type_1_and_Type_2_" + + "are_supported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Het stochastische ondergrondmodel met '{0}' als faalmechanisme type is niet ondersteund. Alleen stochastische ondergrondmodellen met '{1}' als faalmechanisme type zijn ondersteund.. + /// + public static string PipingStochasticSoilModelTransformer_Cannot_tranform_FailureMechanismType_0_Only_FailureMechanismType_1_supported { + get { + return ResourceManager.GetString("PipingStochasticSoilModelTransformer_Cannot_tranform_FailureMechanismType_0_Only_" + + "FailureMechanismType_1_supported", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Kan geen ondergrondmodellen lezen. Mogelijk bestaat de '{0}' tabel niet.. /// public static string SoilDatabaseConstraintsReader_VerifyConstraints_Can_not_read_StochasticSoilModel_Perhaps_table_missing { Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx =================================================================== diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -r763e4e54f2b5478ddebfc09be8c8d1da541e1a15 --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx (.../Resources.resx) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx (.../Resources.resx) (revision 763e4e54f2b5478ddebfc09be8c8d1da541e1a15) @@ -258,4 +258,10 @@ ..\Resources\PipingConfiguratieSchema.xsd;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + Het stochastische ondergrondmodel met '{0}' als faalmechanisme type is niet ondersteund. Alleen stochastische ondergrondmodellen met '{1}' als faalmechanisme type zijn ondersteund. + + + De ondergrondschematisatie van het type '{0}' is niet ondersteund. Alleen ondergrondschematisaties van het type '{1}' of '{2}' zijn ondersteund. + \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingSoilProfileTransformerTest.cs =================================================================== diff -u -r48a688047e3bf0b080a13137f1197363e63c0020 -r763e4e54f2b5478ddebfc09be8c8d1da541e1a15 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingSoilProfileTransformerTest.cs (.../PipingSoilProfileTransformerTest.cs) (revision 48a688047e3bf0b080a13137f1197363e63c0020) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingSoilProfileTransformerTest.cs (.../PipingSoilProfileTransformerTest.cs) (revision 763e4e54f2b5478ddebfc09be8c8d1da541e1a15) @@ -58,8 +58,9 @@ // Assert var exception = Assert.Throws(test); - Assert.AreEqual("Soil profile of type 'TestSoilProfile' is not supported." + - "Only soil profiles of type 'SoilProfile1D' or 'SoilProfile2D' are supported.", exception.Message); + const string message = "De ondergrondschematisatie van het type 'TestSoilProfile' is niet ondersteund. " + + "Alleen ondergrondschematisaties van het type 'SoilProfile1D' of 'SoilProfile2D' zijn ondersteund."; + Assert.AreEqual(message, exception.Message); } [Test] Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingStochasticSoilModelTransformerTest.cs =================================================================== diff -u -re2482d49e8d3da2a393409ebcaf5b0f1ddf34a63 -r763e4e54f2b5478ddebfc09be8c8d1da541e1a15 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingStochasticSoilModelTransformerTest.cs (.../PipingStochasticSoilModelTransformerTest.cs) (revision e2482d49e8d3da2a393409ebcaf5b0f1ddf34a63) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingStochasticSoilModelTransformerTest.cs (.../PipingStochasticSoilModelTransformerTest.cs) (revision 763e4e54f2b5478ddebfc09be8c8d1da541e1a15) @@ -59,8 +59,8 @@ // Assert var exception = Assert.Throws(test); - Assert.AreEqual($"Stochastic soil model of failure mechanism type '{failureMechanismType}' is not supported." + - $"Only stochastic soil model of failure mechanism type '{FailureMechanismType.Piping}' is supported.", exception.Message); + Assert.AreEqual($"Het stochastische ondergrondmodel met '{failureMechanismType}' als faalmechanisme type is niet ondersteund. " + + $"Alleen stochastische ondergrondmodellen met 'Piping' als faalmechanisme type zijn ondersteund.", exception.Message); } [Test] @@ -81,8 +81,9 @@ // Assert var exception = Assert.Throws(test); - Assert.AreEqual("Soil profile of type 'TestSoilProfile' is not supported." + - "Only soil profiles of type 'SoilProfile1D' or 'SoilProfile2D' are supported.", exception.Message); + const string message = "De ondergrondschematisatie van het type 'TestSoilProfile' is niet ondersteund. " + + "Alleen ondergrondschematisaties van het type 'SoilProfile1D' of 'SoilProfile2D' zijn ondersteund."; + Assert.AreEqual(message, exception.Message); } [Test] @@ -153,6 +154,12 @@ Assert.AreEqual(name, transformed.Name); Assert.AreEqual(1, transformed.StochasticSoilProfiles.Count); CollectionAssert.AreEqual(soilModel.Geometry, transformed.Geometry); + + var expectedPipingSoilProfile = new List + { + new PipingStochasticSoilProfile(1.0, PipingSoilProfileTransformer.Transform(profile)) + }; + AssertPipingStochasticSoilProfiles(expectedPipingSoilProfile, transformed.StochasticSoilProfiles); } [Test] @@ -211,6 +218,23 @@ Assert.AreSame(pipingStochasticSoilProfile1.SoilProfile, pipingStochasticSoilProfile2.SoilProfile); } + private static void AssertPipingStochasticSoilProfiles(IList expected, + IList actual) + { + Assert.AreEqual(expected.Count, actual.Count); + for (var i = 0; i < expected.Count; i++) + { + AssertPipingStochasticSoilProfile(expected[i], actual[i]); + } + } + + private static void AssertPipingStochasticSoilProfile(PipingStochasticSoilProfile expected, + PipingStochasticSoilProfile actual) + { + Assert.AreEqual(expected.Probability, actual.Probability); + Assert.AreEqual(expected.SoilProfile, actual.SoilProfile); + } + private class TestSoilProfile : ISoilProfile { public string Name { get; }