Index: Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Helpers/IDistributionExtensions.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Helpers/IDistributionExtensions.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Helpers/IDistributionExtensions.cs (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -0,0 +1,98 @@ +// Copyright (C) Stichting Deltares 2016. 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.Probabilistics; + +namespace Ringtoets.Common.IO.Configurations.Helpers +{ + /// + /// Extension methods for converting to . + /// + public static class IDistributionExtensions + { + /// + /// Configure a new with + /// and + /// taken from + /// . + /// + /// The distribution to take the values from. + /// A new with + /// and + /// set. + /// Thrown when is null. + public static MeanStandardDeviationStochastConfiguration ToStochastConfiguration(this IDistribution distribution) + { + if (distribution == null) + { + throw new ArgumentNullException(nameof(distribution)); + } + return new MeanStandardDeviationStochastConfiguration + { + Mean = distribution.Mean, + StandardDeviation = distribution.StandardDeviation + }; + } + + /// + /// Configure a new with + /// taken from + /// . + /// + /// The distribution to take the values from. + /// A new with + /// set. + /// Thrown when is null. + public static MeanStandardDeviationStochastConfiguration ToStochastConfigurationWithMean(this IDistribution distribution) + { + if (distribution == null) + { + throw new ArgumentNullException(nameof(distribution)); + } + return new MeanStandardDeviationStochastConfiguration + { + Mean = distribution.Mean + }; + } + + /// + /// Configure a new with + /// taken from + /// . + /// + /// The distribution to take the values from. + /// A new with + /// set. + /// Thrown when is null. + public static MeanStandardDeviationStochastConfiguration ToStochastConfigurationWithStandardDeviation(this IDistribution distribution) + { + if (distribution == null) + { + throw new ArgumentNullException(nameof(distribution)); + } + return new MeanStandardDeviationStochastConfiguration + { + StandardDeviation = distribution.StandardDeviation + }; + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Helpers/IVariationCoefficientDistributionExtensions.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Helpers/IVariationCoefficientDistributionExtensions.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Helpers/IVariationCoefficientDistributionExtensions.cs (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -0,0 +1,98 @@ +// Copyright (C) Stichting Deltares 2016. 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.Probabilistics; + +namespace Ringtoets.Common.IO.Configurations.Helpers +{ + /// + /// Extension methods for converting to . + /// + public static class IVariationCoefficientDistributionExtensions + { + /// + /// Configure a new with + /// and + /// taken from + /// . + /// + /// The distribution to take the values from. + /// A new with + /// and + /// set. + /// Thrown when is null. + public static MeanVariationCoefficientStochastConfiguration ToStochastConfiguration(this IVariationCoefficientDistribution distribution) + { + if (distribution == null) + { + throw new ArgumentNullException(nameof(distribution)); + } + return new MeanVariationCoefficientStochastConfiguration + { + Mean = distribution.Mean, + VariationCoefficient = distribution.CoefficientOfVariation + }; + } + + /// + /// Configure a new with + /// taken from + /// . + /// + /// The distribution to take the values from. + /// A new with + /// set. + /// Thrown when is null. + public static MeanVariationCoefficientStochastConfiguration ToStochastConfigurationWithMean(this IVariationCoefficientDistribution distribution) + { + if (distribution == null) + { + throw new ArgumentNullException(nameof(distribution)); + } + return new MeanVariationCoefficientStochastConfiguration + { + Mean = distribution.Mean + }; + } + + /// + /// Configure a new with + /// taken from + /// . + /// + /// The distribution to take the values from. + /// A new with + /// set. + /// Thrown when is null. + public static MeanVariationCoefficientStochastConfiguration ToStochastConfigurationWithVariationCoefficient(this IVariationCoefficientDistribution distribution) + { + if (distribution == null) + { + throw new ArgumentNullException(nameof(distribution)); + } + return new MeanVariationCoefficientStochastConfiguration + { + VariationCoefficient = distribution.CoefficientOfVariation + }; + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Helpers/SchemaBreakWaterTypeConverter.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Helpers/SchemaBreakWaterTypeConverter.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Helpers/SchemaBreakWaterTypeConverter.cs (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -0,0 +1,123 @@ +// Copyright (C) Stichting Deltares 2016. 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.Globalization; +using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.IO.Schema; + +namespace Ringtoets.Common.IO.Configurations.Helpers +{ + /// + /// Converts to and back. + /// + public class SchemaBreakWaterTypeConverter : TypeConverter + { + public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + { + if (destinationType == typeof(BreakWaterType)) + { + return true; + } + return base.CanConvertTo(context, destinationType); + } + + public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + if (destinationType == typeof(string)) + { + var type = (SchemaBreakWaterType) value; + switch (type) + { + case SchemaBreakWaterType.Caisson: + return ConfigurationSchemaIdentifiers.BreakWaterCaisson; + case SchemaBreakWaterType.Dam: + return ConfigurationSchemaIdentifiers.BreakWaterDam; + case SchemaBreakWaterType.Wall: + return ConfigurationSchemaIdentifiers.BreakWaterWall; + default: + throw new NotSupportedException(); + } + } + if (destinationType == typeof(BreakWaterType)) + { + var type = (SchemaBreakWaterType)value; + switch (type) + { + case SchemaBreakWaterType.Caisson: + return BreakWaterType.Caisson; + case SchemaBreakWaterType.Dam: + return BreakWaterType.Dam; + case SchemaBreakWaterType.Wall: + return BreakWaterType.Wall; + default: + throw new NotSupportedException(); + } + } + return base.ConvertTo(context, culture, value, destinationType); + } + + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + if (sourceType == typeof(string)) + { + return true; + } + if (sourceType == typeof(BreakWaterType)) + { + return true; + } + return base.CanConvertFrom(context, sourceType); + } + + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + var text = value as string; + if (text != null) + { + switch (text) + { + case ConfigurationSchemaIdentifiers.BreakWaterCaisson: + return SchemaBreakWaterType.Caisson; + case ConfigurationSchemaIdentifiers.BreakWaterDam: + return SchemaBreakWaterType.Dam; + case ConfigurationSchemaIdentifiers.BreakWaterWall: + return SchemaBreakWaterType.Wall; + } + } + var breakWaterType = value as BreakWaterType?; + if (breakWaterType != null) + { + switch (breakWaterType) + { + case BreakWaterType.Caisson: + return SchemaBreakWaterType.Caisson; + case BreakWaterType.Dam: + return SchemaBreakWaterType.Dam; + case BreakWaterType.Wall: + return SchemaBreakWaterType.Wall; + } + } + return base.ConvertFrom(context, culture, value); + } + } +} \ No newline at end of file Fisheye: Tag 82db5c5ee21fae9e20fee1412dbb29b1c47b038a refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/IDistributionExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 82db5c5ee21fae9e20fee1412dbb29b1c47b038a refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/IVariationCoefficientDistributionExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/SchemaBreakWaterType.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/SchemaBreakWaterType.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/SchemaBreakWaterType.cs (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -0,0 +1,44 @@ +// Copyright (C) Stichting Deltares 2016. 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. + +namespace Ringtoets.Common.IO.Configurations +{ + /// + /// Defines the various types of break water values possible in a read calculation configuration. + /// + public enum SchemaBreakWaterType + { + /// + /// A wall. + /// + Wall = 1, + + /// + /// A watertight retaining structure. + /// + Caisson = 2, + + /// + /// A barrier that impounds water or underground streams. + /// + Dam = 3 + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/WaveReductionConfiguration.cs =================================================================== diff -u -rf3feb7d017a933271c410470add90ae106745ceb -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/WaveReductionConfiguration.cs (.../WaveReductionConfiguration.cs) (revision f3feb7d017a933271c410470add90ae106745ceb) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/WaveReductionConfiguration.cs (.../WaveReductionConfiguration.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -34,7 +34,7 @@ /// /// Gets or sets the type of the break water. /// - public ReadBreakWaterType? BreakWaterType { get; set; } + public SchemaBreakWaterType? BreakWaterType { get; set; } /// /// Gets or sets the height of the break water. Fisheye: Tag 82db5c5ee21fae9e20fee1412dbb29b1c47b038a refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.IO/ReadBreakWaterType.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 82db5c5ee21fae9e20fee1412dbb29b1c47b038a refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.IO/ReadBreakWaterTypeConverter.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj =================================================================== diff -u -rafe6bfdec2a155872cacd3bb3ed786ee5a785118 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision afe6bfdec2a155872cacd3bb3ed786ee5a785118) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -54,14 +54,14 @@ - - + + - + @@ -90,7 +90,7 @@ - + Index: Ringtoets/Common/src/Ringtoets.Common.IO/Writers/CalculationConfigurationWriter.cs =================================================================== diff -u -r7ce0229b2d4293c464479e448b092c7f83eb94c3 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Common/src/Ringtoets.Common.IO/Writers/CalculationConfigurationWriter.cs (.../CalculationConfigurationWriter.cs) (revision 7ce0229b2d4293c464479e448b092c7f83eb94c3) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Writers/CalculationConfigurationWriter.cs (.../CalculationConfigurationWriter.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -27,6 +27,8 @@ using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Common.IO.Configurations; +using Ringtoets.Common.IO.Configurations.Helpers; using Ringtoets.Common.IO.Readers; using Ringtoets.Common.IO.Schema; @@ -155,7 +157,7 @@ { writer.WriteElementString( ConfigurationSchemaIdentifiers.BreakWaterType, - BreakWaterTypeAsXmlString((ReadBreakWaterType) breakWater.Type)); + BreakWaterTypeAsXmlString((SchemaBreakWaterType) breakWater.Type)); writer.WriteElementString( ConfigurationSchemaIdentifiers.BreakWaterHeight, XmlConvert.ToString(breakWater.Height)); @@ -192,9 +194,9 @@ } } - private static string BreakWaterTypeAsXmlString(ReadBreakWaterType type) + private static string BreakWaterTypeAsXmlString(SchemaBreakWaterType type) { - return new ReadBreakWaterTypeConverter().ConvertToInvariantString(type); + return new SchemaBreakWaterTypeConverter().ConvertToInvariantString(type); } private static void WriteDistribution(IDistribution distribution, string elementName, XmlWriter writer) Index: Ringtoets/Common/src/Ringtoets.Common.IO/Writers/StructureCalculationConfigurationWriter.cs =================================================================== diff -u -r43b7d2fe7b1c4209fd2afcd985a5c1f4b7bf14e9 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Common/src/Ringtoets.Common.IO/Writers/StructureCalculationConfigurationWriter.cs (.../StructureCalculationConfigurationWriter.cs) (revision 43b7d2fe7b1c4209fd2afcd985a5c1f4b7bf14e9) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Writers/StructureCalculationConfigurationWriter.cs (.../StructureCalculationConfigurationWriter.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -87,7 +87,7 @@ /// The instance of type for which /// to write the input. /// The writer that should be used to write the parameters. - protected abstract void WriteSpecificStructureParameters(T configuration, XmlWriter writer); + protected virtual void WriteSpecificStructureParameters(T configuration, XmlWriter writer) {} /// /// Writes stochasts definitions specific for a structure of type . Index: Ringtoets/Common/src/Ringtoets.Common.IO/Writers/XmlWriterExtensions.cs =================================================================== diff -u -rafe6bfdec2a155872cacd3bb3ed786ee5a785118 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Common/src/Ringtoets.Common.IO/Writers/XmlWriterExtensions.cs (.../XmlWriterExtensions.cs) (revision afe6bfdec2a155872cacd3bb3ed786ee5a785118) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Writers/XmlWriterExtensions.cs (.../XmlWriterExtensions.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -22,6 +22,7 @@ using System; using System.Xml; using Ringtoets.Common.IO.Configurations; +using Ringtoets.Common.IO.Configurations.Helpers; using Ringtoets.Common.IO.Schema; namespace Ringtoets.Common.IO.Writers @@ -137,7 +138,7 @@ } if (waveReduction.BreakWaterType.HasValue) { - writer.WriteElementString(ConfigurationSchemaIdentifiers.BreakWaterType, new ReadBreakWaterTypeConverter().ConvertToInvariantString(waveReduction.BreakWaterType.Value)); + writer.WriteElementString(ConfigurationSchemaIdentifiers.BreakWaterType, new SchemaBreakWaterTypeConverter().ConvertToInvariantString(waveReduction.BreakWaterType.Value)); } if (waveReduction.BreakWaterHeight.HasValue) { Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/IDistributionExtensionsTest.cs =================================================================== diff -u -rafe6bfdec2a155872cacd3bb3ed786ee5a785118 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/IDistributionExtensionsTest.cs (.../IDistributionExtensionsTest.cs) (revision afe6bfdec2a155872cacd3bb3ed786ee5a785118) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/IDistributionExtensionsTest.cs (.../IDistributionExtensionsTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -26,6 +26,7 @@ using Rhino.Mocks; using Ringtoets.Common.Data.Probabilistics; using Ringtoets.Common.IO.Configurations; +using Ringtoets.Common.IO.Configurations.Helpers; namespace Ringtoets.Common.IO.Test.Configurations { Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/IVariationCoefficientDistributionExtensionsTest.cs =================================================================== diff -u -rafe6bfdec2a155872cacd3bb3ed786ee5a785118 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/IVariationCoefficientDistributionExtensionsTest.cs (.../IVariationCoefficientDistributionExtensionsTest.cs) (revision afe6bfdec2a155872cacd3bb3ed786ee5a785118) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/IVariationCoefficientDistributionExtensionsTest.cs (.../IVariationCoefficientDistributionExtensionsTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -26,6 +26,7 @@ using Rhino.Mocks; using Ringtoets.Common.Data.Probabilistics; using Ringtoets.Common.IO.Configurations; +using Ringtoets.Common.IO.Configurations.Helpers; namespace Ringtoets.Common.IO.Test.Configurations { Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/SchemaBreakWaterTypeConverterTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/SchemaBreakWaterTypeConverterTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/SchemaBreakWaterTypeConverterTest.cs (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -0,0 +1,218 @@ +// Copyright (C) Stichting Deltares 2016. 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 NUnit.Framework; +using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.IO.Configurations; +using Ringtoets.Common.IO.Configurations.Helpers; +using Ringtoets.Common.IO.Schema; + +namespace Ringtoets.Common.IO.Test.Configurations +{ + [TestFixture] + public class SchemaBreakWaterTypeConverterTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var converter = new SchemaBreakWaterTypeConverter(); + + // Assert + Assert.IsInstanceOf(converter); + } + + [Test] + public void CanConvertTo_String_ReturnTrue() + { + // Setup + var converter = new SchemaBreakWaterTypeConverter(); + + // Call + bool canConvertToString = converter.CanConvertTo(typeof(string)); + + // Assert + Assert.IsTrue(canConvertToString); + } + + [Test] + public void CanConvertTo_BreakWaterType_ReturnTrue() + { + // Setup + var converter = new SchemaBreakWaterTypeConverter(); + + // Call + bool canConvertToString = converter.CanConvertTo(typeof(BreakWaterType)); + + // Assert + Assert.IsTrue(canConvertToString); + } + + [Test] + public void CanConvertTo_OtherThanStringOrBreakWaterType_ReturnFalse() + { + // Setup + var converter = new SchemaBreakWaterTypeConverter(); + + // Call + bool canConvertToString = converter.CanConvertTo(typeof(object)); + + // Assert + Assert.IsFalse(canConvertToString); + } + + [Test] + [TestCase(SchemaBreakWaterType.Caisson, ConfigurationSchemaIdentifiers.BreakWaterCaisson)] + [TestCase(SchemaBreakWaterType.Dam, ConfigurationSchemaIdentifiers.BreakWaterDam)] + [TestCase(SchemaBreakWaterType.Wall, ConfigurationSchemaIdentifiers.BreakWaterWall)] + public void ConvertTo_VariousCases_ReturnExpectedText(SchemaBreakWaterType value, + string expectedResult) + { + // Setup + var converter = new SchemaBreakWaterTypeConverter(); + + // Call + object result = converter.ConvertTo(value, typeof(string)); + + // Assert + Assert.AreEqual(expectedResult, result); + } + + [Test] + public void ConvertTo_InvalidBreakWaterType_ThrowNotSupportedException() + { + // Setup + var converter = new SchemaBreakWaterTypeConverter(); + var invalidValue = (SchemaBreakWaterType) 99999999; + + // Call + TestDelegate call = () => converter.ConvertTo(invalidValue, typeof(string)); + + // Assert + Assert.Throws(call); + } + + [Test] + [TestCase(SchemaBreakWaterType.Caisson, BreakWaterType.Caisson)] + [TestCase(SchemaBreakWaterType.Dam, BreakWaterType.Dam)] + [TestCase(SchemaBreakWaterType.Wall, BreakWaterType.Wall)] + public void ConvertTo_VariousCases_ReturnExpectedText(SchemaBreakWaterType value, + BreakWaterType expectedResult) + { + // Setup + var converter = new SchemaBreakWaterTypeConverter(); + + // Call + object result = converter.ConvertTo(value, typeof(BreakWaterType)); + + // Assert + Assert.AreEqual(expectedResult, result); + } + + [Test] + public void CanConvertFrom_String_ReturnTrue() + { + // Setup + var converter = new SchemaBreakWaterTypeConverter(); + + // Call + bool canConvertFromString = converter.CanConvertFrom(typeof(string)); + + // Assert + Assert.IsTrue(canConvertFromString); + } + + [Test] + public void CanConvertFrom_BreakWaterType_ReturnTrue() + { + // Setup + var converter = new SchemaBreakWaterTypeConverter(); + + // Call + bool canConvertFromString = converter.CanConvertFrom(typeof(BreakWaterType)); + + // Assert + Assert.IsTrue(canConvertFromString); + } + + [Test] + public void CanConvertFrom_OtherThanStringOrBreakWaterType_ReturnFalse() + { + // Setup + var converter = new SchemaBreakWaterTypeConverter(); + + // Call + bool canConvertFromString = converter.CanConvertFrom(typeof(object)); + + // Assert + Assert.IsFalse(canConvertFromString); + } + + [Test] + [TestCase(ConfigurationSchemaIdentifiers.BreakWaterCaisson, SchemaBreakWaterType.Caisson)] + [TestCase(ConfigurationSchemaIdentifiers.BreakWaterDam, SchemaBreakWaterType.Dam)] + [TestCase(ConfigurationSchemaIdentifiers.BreakWaterWall, SchemaBreakWaterType.Wall)] + public void ConvertFrom_Text_ReturnExpectedBreakWaterType(string value, + SchemaBreakWaterType expectedResult) + { + // Setup + var converter = new SchemaBreakWaterTypeConverter(); + + // Call + object result = converter.ConvertFrom(value); + + // Assert + Assert.AreEqual(expectedResult, result); + } + + [Test] + public void ConvertFrom_InvalidText_ThrowNotSupportedException() + { + // Setup + var converter = new SchemaBreakWaterTypeConverter(); + + // Call + TestDelegate call = () => converter.ConvertFrom("A"); + + // Assert + Assert.Throws(call); + } + + [Test] + [TestCase(BreakWaterType.Caisson, SchemaBreakWaterType.Caisson)] + [TestCase(BreakWaterType.Dam, SchemaBreakWaterType.Dam)] + [TestCase(BreakWaterType.Wall, SchemaBreakWaterType.Wall)] + public void ConvertFrom_BreakWaterType_ReturnExpectedBreakWaterType(BreakWaterType value, + SchemaBreakWaterType expectedResult) + { + // Setup + var converter = new SchemaBreakWaterTypeConverter(); + + // Call + object result = converter.ConvertFrom(value); + + // Assert + Assert.AreEqual(expectedResult, result); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/WaveReductionConfigurationTest.cs =================================================================== diff -u -rf3feb7d017a933271c410470add90ae106745ceb -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/WaveReductionConfigurationTest.cs (.../WaveReductionConfigurationTest.cs) (revision f3feb7d017a933271c410470add90ae106745ceb) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/WaveReductionConfigurationTest.cs (.../WaveReductionConfigurationTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -50,7 +50,7 @@ var random = new Random(21); bool useBreakWater = random.NextBoolean(); - var breakWaterType = random.NextEnumValue(); + var breakWaterType = random.NextEnumValue(); double breakWaterHeight = random.NextDouble(); bool useForeshore = random.NextBoolean(); Fisheye: Tag 82db5c5ee21fae9e20fee1412dbb29b1c47b038a refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReadBreakWaterTypeConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj =================================================================== diff -u -rafe6bfdec2a155872cacd3bb3ed786ee5a785118 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision afe6bfdec2a155872cacd3bb3ed786ee5a785118) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -66,7 +66,7 @@ - + Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/StructureCalculationConfigurationWriterTest.cs =================================================================== diff -u -r43b7d2fe7b1c4209fd2afcd985a5c1f4b7bf14e9 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/StructureCalculationConfigurationWriterTest.cs (.../StructureCalculationConfigurationWriterTest.cs) (revision 43b7d2fe7b1c4209fd2afcd985a5c1f4b7bf14e9) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/StructureCalculationConfigurationWriterTest.cs (.../StructureCalculationConfigurationWriterTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -141,7 +141,7 @@ StructureName = "Kunstwerk", WaveReduction = new WaveReductionConfiguration { - BreakWaterType = ReadBreakWaterType.Caisson, + BreakWaterType = SchemaBreakWaterType.Caisson, UseBreakWater = false, BreakWaterHeight = 111111.2, UseForeshoreProfile = true Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/XmlWriterExtensionsTest.cs =================================================================== diff -u -rd393a6e22ba176f0ce9731629a37ce3272b1f433 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/XmlWriterExtensionsTest.cs (.../XmlWriterExtensionsTest.cs) (revision d393a6e22ba176f0ce9731629a37ce3272b1f433) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/XmlWriterExtensionsTest.cs (.../XmlWriterExtensionsTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -111,7 +111,7 @@ new WaveReductionConfiguration { UseBreakWater = true, - BreakWaterType = ReadBreakWaterType.Dam, + BreakWaterType = SchemaBreakWaterType.Dam, BreakWaterHeight = 2.33, UseForeshoreProfile = false }, @@ -122,7 +122,7 @@ new WaveReductionConfiguration { UseBreakWater = true, - BreakWaterType = ReadBreakWaterType.Caisson, + BreakWaterType = SchemaBreakWaterType.Caisson, UseForeshoreProfile = false }, "waveReductionWithoutBreakWaterHeight.xml") @@ -141,7 +141,7 @@ yield return new TestCaseData( new WaveReductionConfiguration { - BreakWaterType = ReadBreakWaterType.Wall, + BreakWaterType = SchemaBreakWaterType.Wall, BreakWaterHeight = 23.4, UseForeshoreProfile = false }, @@ -152,7 +152,7 @@ new WaveReductionConfiguration { UseBreakWater = true, - BreakWaterType = ReadBreakWaterType.Dam, + BreakWaterType = SchemaBreakWaterType.Dam, BreakWaterHeight = 0.2, }, "waveReductionWithoutUseForeshoreProfile.xml") Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs =================================================================== diff -u -rd393a6e22ba176f0ce9731629a37ce3272b1f433 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs (.../GrassCoverErosionInwardsCalculationConfigurationReader.cs) (revision d393a6e22ba176f0ce9731629a37ce3272b1f433) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs (.../GrassCoverErosionInwardsCalculationConfigurationReader.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -25,6 +25,7 @@ using Core.Common.Base.IO; using Ringtoets.Common.IO; using Ringtoets.Common.IO.Configurations; +using Ringtoets.Common.IO.Configurations.Helpers; using Ringtoets.Common.IO.Readers; using Ringtoets.Common.IO.Schema; using Ringtoets.GrassCoverErosionInwards.IO.Properties; @@ -92,7 +93,7 @@ DikeHeightCalculationType = (ReadDikeHeightCalculationType?) calculationElement.GetConvertedValueFromDescendantStringElement( GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeHeightCalculationTypeElement), UseBreakWater = calculationElement.GetBoolValueFromDescendantElement(ConfigurationSchemaIdentifiers.UseBreakWater), - BreakWaterType = (ReadBreakWaterType?) calculationElement.GetConvertedValueFromDescendantStringElement(ConfigurationSchemaIdentifiers.BreakWaterType), + BreakWaterType = (SchemaBreakWaterType?) calculationElement.GetConvertedValueFromDescendantStringElement(ConfigurationSchemaIdentifiers.BreakWaterType), BreakWaterHeight = calculationElement.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.BreakWaterHeight), UseForeshore = calculationElement.GetBoolValueFromDescendantElement(ConfigurationSchemaIdentifiers.UseForeshore) }; Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/ReadGrassCoverErosionInwardsCalculation.cs =================================================================== diff -u -rcc1268d7cb906524d4cabcd4cbd9ae16676cf059 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/ReadGrassCoverErosionInwardsCalculation.cs (.../ReadGrassCoverErosionInwardsCalculation.cs) (revision cc1268d7cb906524d4cabcd4cbd9ae16676cf059) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/ReadGrassCoverErosionInwardsCalculation.cs (.../ReadGrassCoverErosionInwardsCalculation.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -96,7 +96,7 @@ /// /// Gets the type of break water for the grass cover erosion inwards calculation. /// - public ReadBreakWaterType? BreakWaterType { get; } + public SchemaBreakWaterType? BreakWaterType { get; } /// /// Gets the height of the break water for the grass cover erosion inwards calculation. @@ -166,7 +166,7 @@ /// /// Gets or sets the value for . /// - public ReadBreakWaterType? BreakWaterType { get; set; } + public SchemaBreakWaterType? BreakWaterType { get; set; } /// /// Gets or sets the value for . Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/GrassCoverErosionInwardsCalculationConfigurationReaderTest.cs =================================================================== diff -u -r4f3f2104e2bc7287411c5e59090676ba20c199ae -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/GrassCoverErosionInwardsCalculationConfigurationReaderTest.cs (.../GrassCoverErosionInwardsCalculationConfigurationReaderTest.cs) (revision 4f3f2104e2bc7287411c5e59090676ba20c199ae) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/GrassCoverErosionInwardsCalculationConfigurationReaderTest.cs (.../GrassCoverErosionInwardsCalculationConfigurationReaderTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -330,7 +330,7 @@ Assert.AreEqual(3.45, calculation.DikeHeight); Assert.AreEqual(ReadDikeHeightCalculationType.CalculateByAssessmentSectionNorm, calculation.DikeHeightCalculationType); Assert.AreEqual(true, calculation.UseBreakWater); - Assert.AreEqual(ReadBreakWaterType.Dam, calculation.BreakWaterType); + Assert.AreEqual(SchemaBreakWaterType.Dam, calculation.BreakWaterType); Assert.AreEqual(1.234, calculation.BreakWaterHeight); Assert.AreEqual(false, calculation.UseForeshore); Assert.AreEqual(0.1, calculation.CriticalFlowRateMean); Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/ReadGrassCoverErosionInwardsCalculationTest.cs =================================================================== diff -u -rcc1268d7cb906524d4cabcd4cbd9ae16676cf059 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/ReadGrassCoverErosionInwardsCalculationTest.cs (.../ReadGrassCoverErosionInwardsCalculationTest.cs) (revision cc1268d7cb906524d4cabcd4cbd9ae16676cf059) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/ReadGrassCoverErosionInwardsCalculationTest.cs (.../ReadGrassCoverErosionInwardsCalculationTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -76,7 +76,7 @@ const double dikeHeight = 2.2; const ReadDikeHeightCalculationType calculationType = ReadDikeHeightCalculationType.CalculateByAssessmentSectionNorm; const bool useBreakWater = true; - const ReadBreakWaterType breakWaterType = ReadBreakWaterType.Wall; + const SchemaBreakWaterType breakWaterType = SchemaBreakWaterType.Wall; const double breakWaterHeight = 3.3; const bool useForeshore = true; const double criticalFlowMean = 4.4; Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresCalculationConfigurationExporter.cs =================================================================== diff -u -rafe6bfdec2a155872cacd3bb3ed786ee5a785118 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresCalculationConfigurationExporter.cs (.../HeightStructuresCalculationConfigurationExporter.cs) (revision afe6bfdec2a155872cacd3bb3ed786ee5a785118) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresCalculationConfigurationExporter.cs (.../HeightStructuresCalculationConfigurationExporter.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -22,10 +22,9 @@ using System; using System.Collections.Generic; using Ringtoets.Common.Data.Calculation; -using Ringtoets.Common.Data.Probabilistics; using Ringtoets.Common.Data.Structures; -using Ringtoets.Common.IO; using Ringtoets.Common.IO.Configurations; +using Ringtoets.Common.IO.Configurations.Helpers; using Ringtoets.Common.IO.Exporters; using Ringtoets.HeightStructures.Data; @@ -76,7 +75,7 @@ { UseForeshoreProfile = input.UseForeshore, UseBreakWater = input.UseBreakWater, - BreakWaterType = (ReadBreakWaterType) input.BreakWater.Type, + BreakWaterType = (SchemaBreakWaterType?) new SchemaBreakWaterTypeConverter().ConvertFrom(input.BreakWater.Type), BreakWaterHeight = input.BreakWater.Height }; } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresCalculationConfigurationReader.cs =================================================================== diff -u -r928b72eb0fe0476d085e49e21ffd325b749a7db9 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresCalculationConfigurationReader.cs (.../HeightStructuresCalculationConfigurationReader.cs) (revision 928b72eb0fe0476d085e49e21ffd325b749a7db9) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresCalculationConfigurationReader.cs (.../HeightStructuresCalculationConfigurationReader.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -23,6 +23,7 @@ using System.Xml.Linq; using Ringtoets.Common.IO; using Ringtoets.Common.IO.Configurations; +using Ringtoets.Common.IO.Configurations.Helpers; using Ringtoets.Common.IO.Readers; using Ringtoets.Common.IO.Schema; using Ringtoets.HeightStructures.IO.Properties; @@ -104,7 +105,7 @@ { return new WaveReductionConfiguration { - BreakWaterType = (ReadBreakWaterType?) calculationElement.GetConvertedValueFromDescendantStringElement(ConfigurationSchemaIdentifiers.BreakWaterType), + BreakWaterType = (SchemaBreakWaterType?) calculationElement.GetConvertedValueFromDescendantStringElement(ConfigurationSchemaIdentifiers.BreakWaterType), BreakWaterHeight = calculationElement.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.BreakWaterHeight), UseBreakWater = calculationElement.GetBoolValueFromDescendantElement(ConfigurationSchemaIdentifiers.UseBreakWater), UseForeshoreProfile = calculationElement.GetBoolValueFromDescendantElement(ConfigurationSchemaIdentifiers.UseForeshore) Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresCalculationConfigurationWriter.cs =================================================================== diff -u -r43b7d2fe7b1c4209fd2afcd985a5c1f4b7bf14e9 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresCalculationConfigurationWriter.cs (.../HeightStructuresCalculationConfigurationWriter.cs) (revision 43b7d2fe7b1c4209fd2afcd985a5c1f4b7bf14e9) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresCalculationConfigurationWriter.cs (.../HeightStructuresCalculationConfigurationWriter.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -44,8 +44,6 @@ /// public HeightStructuresCalculationConfigurationWriter(string filePath) : base(filePath) {} - protected override void WriteSpecificStructureParameters(HeightStructuresCalculationConfiguration configuration, XmlWriter writer) {} - protected override void WriteSpecificStochasts(HeightStructuresCalculationConfiguration configuration, XmlWriter writer) { WriteDistributionWhenAvailable(writer, Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresConfigurationSchemaIdentifiers.cs =================================================================== diff -u -r3c686d6ea57d86134a4338e75d3c7663f379716e -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresConfigurationSchemaIdentifiers.cs (.../HeightStructuresConfigurationSchemaIdentifiers.cs) (revision 3c686d6ea57d86134a4338e75d3c7663f379716e) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresConfigurationSchemaIdentifiers.cs (.../HeightStructuresConfigurationSchemaIdentifiers.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -31,7 +31,7 @@ /// /// The identifier for the level crest structure stochast name. /// - internal const string LevelCrestStructureStochastName = "kerendehoogte"; + public const string LevelCrestStructureStochastName = "kerendehoogte"; #endregion } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/TestHeightStructuresCalculation.cs =================================================================== diff -u -r3c686d6ea57d86134a4338e75d3c7663f379716e -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/TestHeightStructuresCalculation.cs (.../TestHeightStructuresCalculation.cs) (revision 3c686d6ea57d86134a4338e75d3c7663f379716e) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/TestHeightStructuresCalculation.cs (.../TestHeightStructuresCalculation.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -44,7 +44,7 @@ InputParameters.AllowedLevelIncreaseStorage.StandardDeviation = (RoundedDouble) 0.12; InputParameters.FlowWidthAtBottomProtection.Mean = (RoundedDouble) 18; InputParameters.FlowWidthAtBottomProtection.StandardDeviation = (RoundedDouble) 8.2; - InputParameters.CriticalOvertoppingDischarge.Mean = (RoundedDouble) 1; + InputParameters.CriticalOvertoppingDischarge.Mean = (RoundedDouble) 1.0; InputParameters.CriticalOvertoppingDischarge.CoefficientOfVariation = (RoundedDouble) 0.88; InputParameters.WidthFlowApertures.Mean = (RoundedDouble) 18; InputParameters.WidthFlowApertures.StandardDeviation = (RoundedDouble) 2; Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/HeightStructuresCalculationConfigurationExporterTest.cs =================================================================== diff -u -rd393a6e22ba176f0ce9731629a37ce3272b1f433 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/HeightStructuresCalculationConfigurationExporterTest.cs (.../HeightStructuresCalculationConfigurationExporterTest.cs) (revision d393a6e22ba176f0ce9731629a37ce3272b1f433) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/HeightStructuresCalculationConfigurationExporterTest.cs (.../HeightStructuresCalculationConfigurationExporterTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -137,11 +137,13 @@ }, StormDuration = new VariationCoefficientLogNormalDistribution { - Mean = (RoundedDouble) 6.0 + Mean = (RoundedDouble) 6.0, + CoefficientOfVariation = (RoundedDouble) 1.2222 }, ModelFactorSuperCriticalFlow = new NormalDistribution { - Mean = (RoundedDouble) 1.10 + Mean = (RoundedDouble) 1.10, + StandardDeviation = (RoundedDouble) 1.2222 }, FlowWidthAtBottomProtection = new LogNormalDistribution { Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/HeightStructuresCalculationConfigurationReaderTest.cs =================================================================== diff -u -r928b72eb0fe0476d085e49e21ffd325b749a7db9 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/HeightStructuresCalculationConfigurationReaderTest.cs (.../HeightStructuresCalculationConfigurationReaderTest.cs) (revision 928b72eb0fe0476d085e49e21ffd325b749a7db9) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/HeightStructuresCalculationConfigurationReaderTest.cs (.../HeightStructuresCalculationConfigurationReaderTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -306,7 +306,7 @@ Assert.AreEqual(15.2, calculation.WidthFlowApertures.Mean); Assert.AreEqual(0.1, calculation.WidthFlowApertures.StandardDeviation); - Assert.AreEqual(ReadBreakWaterType.Dam, calculation.WaveReduction.BreakWaterType); + Assert.AreEqual(SchemaBreakWaterType.Dam, calculation.WaveReduction.BreakWaterType); Assert.AreEqual(1.234, calculation.WaveReduction.BreakWaterHeight); Assert.IsTrue(calculation.WaveReduction.UseBreakWater); Assert.IsTrue(calculation.WaveReduction.UseForeshoreProfile); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/HeightStructuresCalculationConfigurationWriterTest.cs =================================================================== diff -u -re50b6ad32d33acb630c391bce2a6d359cc7e2b28 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/HeightStructuresCalculationConfigurationWriterTest.cs (.../HeightStructuresCalculationConfigurationWriterTest.cs) (revision e50b6ad32d33acb630c391bce2a6d359cc7e2b28) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/HeightStructuresCalculationConfigurationWriterTest.cs (.../HeightStructuresCalculationConfigurationWriterTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -116,7 +116,7 @@ WaveReduction = new WaveReductionConfiguration { UseBreakWater = true, - BreakWaterType = ReadBreakWaterType.Dam, + BreakWaterType = SchemaBreakWaterType.Dam, BreakWaterHeight = 1.23, UseForeshoreProfile = true }, Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/test-data/HeightStructuresCalculationConfigurationExporter/configurationWithForeshoreProfile.xml =================================================================== diff -u -r1de8babc6b4f83b087b767257bc09770e27b5119 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/test-data/HeightStructuresCalculationConfigurationExporter/configurationWithForeshoreProfile.xml (.../configurationWithForeshoreProfile.xml) (revision 1de8babc6b4f83b087b767257bc09770e27b5119) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/test-data/HeightStructuresCalculationConfigurationExporter/configurationWithForeshoreProfile.xml (.../configurationWithForeshoreProfile.xml) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -4,6 +4,8 @@ profiel1 false + havendam + 0 true Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/ExportInfos/HeightStructuresCalculationGroupContextExportInfoTest.cs =================================================================== diff -u -rbe64b9f33b3065a4d80c0a93c1cafe3d74f43513 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/ExportInfos/HeightStructuresCalculationGroupContextExportInfoTest.cs (.../HeightStructuresCalculationGroupContextExportInfoTest.cs) (revision be64b9f33b3065a4d80c0a93c1cafe3d74f43513) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/ExportInfos/HeightStructuresCalculationGroupContextExportInfoTest.cs (.../HeightStructuresCalculationGroupContextExportInfoTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -67,8 +67,8 @@ mocks.ReplayAll(); var context = new HeightStructuresCalculationGroupContext(new CalculationGroup(), - new HeightStructuresFailureMechanism(), - assessmentSection); + new HeightStructuresFailureMechanism(), + assessmentSection); using (var plugin = new HeightStructuresPlugin()) { @@ -108,8 +108,8 @@ mocks.ReplayAll(); var context = new HeightStructuresCalculationGroupContext(new CalculationGroup(), - new HeightStructuresFailureMechanism(), - assessmentSection); + new HeightStructuresFailureMechanism(), + assessmentSection); using (var plugin = new HeightStructuresPlugin()) { @@ -147,8 +147,8 @@ } var context = new HeightStructuresCalculationGroupContext(calculationGroup, - new HeightStructuresFailureMechanism(), - assessmentSection); + new HeightStructuresFailureMechanism(), + assessmentSection); using (var plugin = new HeightStructuresPlugin()) { Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresPluginTest.cs =================================================================== diff -u -rbe64b9f33b3065a4d80c0a93c1cafe3d74f43513 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresPluginTest.cs (.../HeightStructuresPluginTest.cs) (revision be64b9f33b3065a4d80c0a93c1cafe3d74f43513) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresPluginTest.cs (.../HeightStructuresPluginTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -144,6 +144,7 @@ Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(HeightStructuresContext))); } } + [Test] public void GetExportInfos_ReturnsSupportedExportInfos() { Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Readers/ReadWaveConditionsCalculation.cs =================================================================== diff -u -rcc1268d7cb906524d4cabcd4cbd9ae16676cf059 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Readers/ReadWaveConditionsCalculation.cs (.../ReadWaveConditionsCalculation.cs) (revision cc1268d7cb906524d4cabcd4cbd9ae16676cf059) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Readers/ReadWaveConditionsCalculation.cs (.../ReadWaveConditionsCalculation.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -106,7 +106,7 @@ /// /// Gets the breakwater type of the read calculation. /// - public ReadBreakWaterType? BreakWaterType { get; } + public SchemaBreakWaterType? BreakWaterType { get; } /// /// Gets the breakwater height of the read calculation. @@ -178,7 +178,7 @@ /// /// Gets or sets the value for . /// - public ReadBreakWaterType? BreakWaterType { internal get; set; } + public SchemaBreakWaterType? BreakWaterType { internal get; set; } /// /// Gets or sets the value for . Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Readers/WaveConditionsCalculationConfigurationReader.cs =================================================================== diff -u -rcc1268d7cb906524d4cabcd4cbd9ae16676cf059 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Readers/WaveConditionsCalculationConfigurationReader.cs (.../WaveConditionsCalculationConfigurationReader.cs) (revision cc1268d7cb906524d4cabcd4cbd9ae16676cf059) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Readers/WaveConditionsCalculationConfigurationReader.cs (.../WaveConditionsCalculationConfigurationReader.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -25,6 +25,7 @@ using Core.Common.Base.IO; using Ringtoets.Common.IO; using Ringtoets.Common.IO.Configurations; +using Ringtoets.Common.IO.Configurations.Helpers; using Ringtoets.Common.IO.Readers; using Ringtoets.Common.IO.Schema; using Ringtoets.Revetment.IO.Properties; @@ -89,7 +90,7 @@ ForeshoreProfile = calculationElement.GetStringValueFromDescendantElement(WaveConditionsCalculationConfigurationSchemaIdentifiers.ForeshoreProfile), Orientation = calculationElement.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.Orientation), UseBreakWater = calculationElement.GetBoolValueFromDescendantElement(ConfigurationSchemaIdentifiers.UseBreakWater), - BreakWaterType = (ReadBreakWaterType?) calculationElement.GetConvertedValueFromDescendantStringElement(ConfigurationSchemaIdentifiers.BreakWaterType), + BreakWaterType = (SchemaBreakWaterType?) calculationElement.GetConvertedValueFromDescendantStringElement(ConfigurationSchemaIdentifiers.BreakWaterType), BreakWaterHeight = calculationElement.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.BreakWaterHeight), UseForeshore = calculationElement.GetBoolValueFromDescendantElement(ConfigurationSchemaIdentifiers.UseForeshore) }; Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Readers/ReadWaveConditionsCalculationTest.cs =================================================================== diff -u -rcc1268d7cb906524d4cabcd4cbd9ae16676cf059 -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Readers/ReadWaveConditionsCalculationTest.cs (.../ReadWaveConditionsCalculationTest.cs) (revision cc1268d7cb906524d4cabcd4cbd9ae16676cf059) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Readers/ReadWaveConditionsCalculationTest.cs (.../ReadWaveConditionsCalculationTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -79,7 +79,7 @@ const string foreshoreProfileName = "Name of the foreshore profile"; const double orientation = 6.6; const bool useBreakWater = true; - const ReadBreakWaterType breakWaterType = ReadBreakWaterType.Caisson; + const SchemaBreakWaterType breakWaterType = SchemaBreakWaterType.Caisson; const double breakWaterHeight = 7.7; const bool useForeshore = false; Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Readers/WaveConditionsCalculationConfigurationReaderTest.cs =================================================================== diff -u -r4f3f2104e2bc7287411c5e59090676ba20c199ae -r82db5c5ee21fae9e20fee1412dbb29b1c47b038a --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Readers/WaveConditionsCalculationConfigurationReaderTest.cs (.../WaveConditionsCalculationConfigurationReaderTest.cs) (revision 4f3f2104e2bc7287411c5e59090676ba20c199ae) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Readers/WaveConditionsCalculationConfigurationReaderTest.cs (.../WaveConditionsCalculationConfigurationReaderTest.cs) (revision 82db5c5ee21fae9e20fee1412dbb29b1c47b038a) @@ -336,7 +336,7 @@ Assert.AreEqual("Voorlandprofiel", calculation.ForeshoreProfile); Assert.AreEqual(5.5, calculation.Orientation); Assert.IsTrue(calculation.UseBreakWater); - Assert.AreEqual(ReadBreakWaterType.Caisson, calculation.BreakWaterType); + Assert.AreEqual(SchemaBreakWaterType.Caisson, calculation.BreakWaterType); Assert.AreEqual(6.6, calculation.BreakWaterHeight); Assert.IsFalse(calculation.UseForeshore); } @@ -366,7 +366,7 @@ Assert.IsNull(calculation.ForeshoreProfile); Assert.IsNull(calculation.Orientation); Assert.IsTrue(calculation.UseBreakWater); - Assert.AreEqual(ReadBreakWaterType.Caisson, calculation.BreakWaterType); + Assert.AreEqual(SchemaBreakWaterType.Caisson, calculation.BreakWaterType); Assert.AreEqual(3.3, calculation.BreakWaterHeight); Assert.IsNull(calculation.UseForeshore); }