Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.Designer.cs
===================================================================
diff -u -rdb30f2625baddbc43890f324a4449a5f1125e548 -r40c3054d4339ac54e91ee80febe649f387485c6c
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision db30f2625baddbc43890f324a4449a5f1125e548)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 40c3054d4339ac54e91ee80febe649f387485c6c)
@@ -166,27 +166,28 @@
///
/// Looks up a localized string similar to norm.
///
- internal static string ReadSubCalculationTypeConverter_CalculateByAssessmentSectionNorm {
+ internal static string ReadHydraulicLoadsCalculationTypeConverter_CalculateByAssessmentSectionNorm {
get {
- return ResourceManager.GetString("ReadSubCalculationTypeConverter_CalculateByAssessmentSectionNorm", resourceCulture);
+ return ResourceManager.GetString("ReadHydraulicLoadsCalculationTypeConverter_CalculateByAssessmentSectionNorm", resourceCulture);
}
}
///
/// Looks up a localized string similar to doorsnede.
///
- internal static string ReadSubCalculationTypeConverter_CalculateByProfileSpecificRequiredProbability {
+ internal static string ReadHydraulicLoadsCalculationTypeConverter_CalculateByProfileSpecificRequiredProbability {
get {
- return ResourceManager.GetString("ReadSubCalculationTypeConverter_CalculateByProfileSpecificRequiredProbability", resourceCulture);
+ return ResourceManager.GetString("ReadHydraulicLoadsCalculationTypeConverter_CalculateByProfileSpecificRequiredProb" +
+ "ability", resourceCulture);
}
}
///
/// Looks up a localized string similar to niet.
///
- internal static string ReadSubCalculationTypeConverter_NoCalculation {
+ internal static string ReadHydraulicLoadsCalculationTypeConverter_NoCalculation {
get {
- return ResourceManager.GetString("ReadSubCalculationTypeConverter_NoCalculation", resourceCulture);
+ return ResourceManager.GetString("ReadHydraulicLoadsCalculationTypeConverter_NoCalculation", resourceCulture);
}
}
}
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.resx
===================================================================
diff -u -rdb30f2625baddbc43890f324a4449a5f1125e548 -r40c3054d4339ac54e91ee80febe649f387485c6c
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.resx (.../Resources.resx) (revision db30f2625baddbc43890f324a4449a5f1125e548)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.resx (.../Resources.resx) (revision 40c3054d4339ac54e91ee80febe649f387485c6c)
@@ -121,13 +121,13 @@
..\Resources\GEKBConfiguratieSchema.xsd;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252
-
+
niet
-
+
norm
-
+
doorsnede
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadHydraulicLoadsCalculationTypeConverter.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadHydraulicLoadsCalculationTypeConverter.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadHydraulicLoadsCalculationTypeConverter.cs (revision 40c3054d4339ac54e91ee80febe649f387485c6c)
@@ -0,0 +1,84 @@
+// 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.GrassCoverErosionInwards.IO.Properties;
+
+namespace Ringtoets.GrassCoverErosionInwards.IO
+{
+ ///
+ /// Converts to and back.
+ ///
+ public class ReadHydraulicLoadsCalculationTypeConverter : TypeConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if (destinationType == typeof(string))
+ {
+ var readHydraulicLoadsCalculationType = (ReadHydraulicLoadsCalculationType) value;
+ switch (readHydraulicLoadsCalculationType)
+ {
+ case ReadHydraulicLoadsCalculationType.NoCalculation:
+ return Resources.ReadHydraulicLoadsCalculationTypeConverter_NoCalculation;
+ case ReadHydraulicLoadsCalculationType.CalculateByAssessmentSectionNorm:
+ return Resources.ReadHydraulicLoadsCalculationTypeConverter_CalculateByAssessmentSectionNorm;
+ case ReadHydraulicLoadsCalculationType.CalculateByProfileSpecificRequiredProbability:
+ return Resources.ReadHydraulicLoadsCalculationTypeConverter_CalculateByProfileSpecificRequiredProbability;
+ 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;
+ }
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ var text = value as string;
+ if (text != null)
+ {
+ if (text == Resources.ReadHydraulicLoadsCalculationTypeConverter_NoCalculation)
+ {
+ return ReadHydraulicLoadsCalculationType.NoCalculation;
+ }
+ if (text == Resources.ReadHydraulicLoadsCalculationTypeConverter_CalculateByAssessmentSectionNorm)
+ {
+ return ReadHydraulicLoadsCalculationType.CalculateByAssessmentSectionNorm;
+ }
+ if (text == Resources.ReadHydraulicLoadsCalculationTypeConverter_CalculateByProfileSpecificRequiredProbability)
+ {
+ return ReadHydraulicLoadsCalculationType.CalculateByProfileSpecificRequiredProbability;
+ }
+ }
+ return base.ConvertFrom(context, culture, value);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 40c3054d4339ac54e91ee80febe649f387485c6c refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadSubCalculationTypeConverter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs
===================================================================
diff -u -r1d0d15d06ee8bbca20b17d9b6776c859a4100095 -r40c3054d4339ac54e91ee80febe649f387485c6c
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs (.../GrassCoverErosionInwardsCalculationConfigurationReader.cs) (revision 1d0d15d06ee8bbca20b17d9b6776c859a4100095)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs (.../GrassCoverErosionInwardsCalculationConfigurationReader.cs) (revision 40c3054d4339ac54e91ee80febe649f387485c6c)
@@ -88,9 +88,9 @@
DikeProfile = calculationElement.GetStringValueFromDescendantElement(GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeProfileElement),
Orientation = calculationElement.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.Orientation),
DikeHeight = calculationElement.GetDoubleValueFromDescendantElement(GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeHeightElement),
- DikeHeightCalculationType = (ReadHydraulicLoadsCalculationType?) calculationElement.GetConvertedValueFromDescendantStringElement(
+ DikeHeightCalculationType = (ReadHydraulicLoadsCalculationType?) calculationElement.GetConvertedValueFromDescendantStringElement(
GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeHeightCalculationTypeElement),
- OvertoppingRateCalculationType = (ReadHydraulicLoadsCalculationType?) calculationElement.GetConvertedValueFromDescendantStringElement(
+ OvertoppingRateCalculationType = (ReadHydraulicLoadsCalculationType?) calculationElement.GetConvertedValueFromDescendantStringElement(
GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.OvertoppingRateCalculationTypeElement),
UseBreakWater = calculationElement.GetBoolValueFromDescendantElement(ConfigurationSchemaIdentifiers.UseBreakWater),
BreakWaterType = (ConfigurationBreakWaterType?) calculationElement.GetConvertedValueFromDescendantStringElement(ConfigurationSchemaIdentifiers.BreakWaterType),
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj
===================================================================
diff -u -r1d0d15d06ee8bbca20b17d9b6776c859a4100095 -r40c3054d4339ac54e91ee80febe649f387485c6c
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.csproj) (revision 1d0d15d06ee8bbca20b17d9b6776c859a4100095)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.csproj) (revision 40c3054d4339ac54e91ee80febe649f387485c6c)
@@ -45,7 +45,7 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Writers/GrassCoverErosionInwardsCalculationConfigurationWriter.cs
===================================================================
diff -u -r1d0d15d06ee8bbca20b17d9b6776c859a4100095 -r40c3054d4339ac54e91ee80febe649f387485c6c
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Writers/GrassCoverErosionInwardsCalculationConfigurationWriter.cs (.../GrassCoverErosionInwardsCalculationConfigurationWriter.cs) (revision 1d0d15d06ee8bbca20b17d9b6776c859a4100095)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Writers/GrassCoverErosionInwardsCalculationConfigurationWriter.cs (.../GrassCoverErosionInwardsCalculationConfigurationWriter.cs) (revision 40c3054d4339ac54e91ee80febe649f387485c6c)
@@ -50,11 +50,11 @@
writer.WriteElementString(
GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeHeightCalculationTypeElement,
- SubCalculationTypeAsXmlString((ReadHydraulicLoadsCalculationType) input.DikeHeightCalculationType));
+ HydraulicLoadsCalculationTypeAsXmlString((ReadHydraulicLoadsCalculationType) input.DikeHeightCalculationType));
writer.WriteElementString(
GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.OvertoppingRateCalculationTypeElement,
- SubCalculationTypeAsXmlString((ReadHydraulicLoadsCalculationType) input.OvertoppingRateCalculationType));
+ HydraulicLoadsCalculationTypeAsXmlString((ReadHydraulicLoadsCalculationType) input.OvertoppingRateCalculationType));
WriteWaveReduction(input, writer);
@@ -111,9 +111,9 @@
XmlConvert.ToString(input.DikeHeight));
}
- private static string SubCalculationTypeAsXmlString(ReadHydraulicLoadsCalculationType type)
+ private static string HydraulicLoadsCalculationTypeAsXmlString(ReadHydraulicLoadsCalculationType type)
{
- return new ReadSubCalculationTypeConverter().ConvertToInvariantString(type);
+ return new ReadHydraulicLoadsCalculationTypeConverter().ConvertToInvariantString(type);
}
private static void WriteWaveReduction(GrassCoverErosionInwardsInput input, XmlWriter writer)
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs
===================================================================
diff -u -r617e9d4ecc8ca783391a7483bbccc1f9fafb6dae -r40c3054d4339ac54e91ee80febe649f387485c6c
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs (.../GrassCoverErosionInwardsOutputPropertiesTest.cs) (revision 617e9d4ecc8ca783391a7483bbccc1f9fafb6dae)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs (.../GrassCoverErosionInwardsOutputPropertiesTest.cs) (revision 40c3054d4339ac54e91ee80febe649f387485c6c)
@@ -48,8 +48,8 @@
private const int waveHeightIndex = 5;
private const int isDominantIndex = 6;
- private const int firstSubCalculationOutputIndex = 7;
- private const int secondSubCalculationOutputIndex = 13;
+ private const int firstHydraulicLoadsOutputIndex = 7;
+ private const int secondHydraulicLoadsOutputIndex = 13;
[Test]
public void Constructor_ExpectedValues()
@@ -170,8 +170,8 @@
Assert.AreEqual(19, dynamicProperties.Count);
AssertResultOutputProperties(dynamicProperties);
- AssertDikeHeightOutputProperties(dynamicProperties, firstSubCalculationOutputIndex);
- AssertOvertoppingRateOutputProperties(dynamicProperties, secondSubCalculationOutputIndex);
+ AssertDikeHeightOutputProperties(dynamicProperties, firstHydraulicLoadsOutputIndex);
+ AssertOvertoppingRateOutputProperties(dynamicProperties, secondHydraulicLoadsOutputIndex);
}
[Test]
@@ -213,12 +213,12 @@
if (dikeHeightCalculated)
{
- AssertDikeHeightOutputProperties(dynamicProperties, firstSubCalculationOutputIndex);
+ AssertDikeHeightOutputProperties(dynamicProperties, firstHydraulicLoadsOutputIndex);
}
if (overtoppingRateCalculated)
{
- AssertOvertoppingRateOutputProperties(dynamicProperties, firstSubCalculationOutputIndex);
+ AssertOvertoppingRateOutputProperties(dynamicProperties, firstHydraulicLoadsOutputIndex);
}
}
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/ReadHydraulicLoadsCalculationTypeConverterTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/ReadHydraulicLoadsCalculationTypeConverterTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/ReadHydraulicLoadsCalculationTypeConverterTest.cs (revision 40c3054d4339ac54e91ee80febe649f387485c6c)
@@ -0,0 +1,166 @@
+// 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;
+
+namespace Ringtoets.GrassCoverErosionInwards.IO.Test
+{
+ [TestFixture]
+ public class ReadHydraulicLoadsCalculationTypeConverterTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var converter = new ReadHydraulicLoadsCalculationTypeConverter();
+
+ // Assert
+ Assert.IsInstanceOf(converter);
+ }
+
+ [Test]
+ public void CanConvertTo_String_ReturnTrue()
+ {
+ // Setup
+ var converter = new ReadHydraulicLoadsCalculationTypeConverter();
+
+ // Call
+ bool canConvertToString = converter.CanConvertTo(typeof(string));
+
+ // Assert
+ Assert.IsTrue(canConvertToString);
+ }
+
+ [Test]
+ public void CanConvertTo_NotString_ReturnFalse()
+ {
+ // Setup
+ var converter = new ReadHydraulicLoadsCalculationTypeConverter();
+
+ // Call
+ bool canConvert = converter.CanConvertTo(typeof(object));
+
+ // Assert
+ Assert.IsFalse(canConvert);
+ }
+
+ [Test]
+ [TestCase(ReadHydraulicLoadsCalculationType.NoCalculation, "niet")]
+ [TestCase(ReadHydraulicLoadsCalculationType.CalculateByAssessmentSectionNorm, "norm")]
+ [TestCase(ReadHydraulicLoadsCalculationType.CalculateByProfileSpecificRequiredProbability, "doorsnede")]
+ public void ConvertTo_VariousCases_ReturnExpectedValues(ReadHydraulicLoadsCalculationType value, string expectedResult)
+ {
+ // Setup
+ var converter = new ReadHydraulicLoadsCalculationTypeConverter();
+
+ // Call
+ object result = converter.ConvertTo(value, typeof(string));
+
+ // Assert
+ Assert.AreEqual(expectedResult, result);
+ }
+
+ [Test]
+ public void ConvertTo_InvalidReadHydraulicLoadsCalculationTypeValue_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ReadHydraulicLoadsCalculationTypeConverter();
+
+ var invalidValue = (ReadHydraulicLoadsCalculationType) 9999999;
+
+ // Call
+ TestDelegate call = () => converter.ConvertTo(invalidValue, typeof(string));
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void ConvertTo_Object_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ReadHydraulicLoadsCalculationTypeConverter();
+
+ // Call
+ TestDelegate call = () => converter.ConvertTo(ReadHydraulicLoadsCalculationType.NoCalculation, typeof(object));
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void CanConvertFrom_String_ReturnTrue()
+ {
+ // Setup
+ var converter = new ReadHydraulicLoadsCalculationTypeConverter();
+
+ // Call
+ bool canConvertFromString = converter.CanConvertFrom(typeof(string));
+
+ // Assert
+ Assert.IsTrue(canConvertFromString);
+ }
+
+ [Test]
+ public void CanConvertFrom_NonString_ReturnFalse()
+ {
+ // Setup
+ var converter = new ReadHydraulicLoadsCalculationTypeConverter();
+
+ // Call
+ bool canConvert = converter.CanConvertFrom(typeof(object));
+
+ // Assert
+ Assert.IsFalse(canConvert);
+ }
+
+ [Test]
+ [TestCase("niet", ReadHydraulicLoadsCalculationType.NoCalculation)]
+ [TestCase("norm", ReadHydraulicLoadsCalculationType.CalculateByAssessmentSectionNorm)]
+ [TestCase("doorsnede", ReadHydraulicLoadsCalculationType.CalculateByProfileSpecificRequiredProbability)]
+ public void ConvertFrom_VariousCases_ReturnExpectedValue(string value, ReadHydraulicLoadsCalculationType expectedResult)
+ {
+ // Setup
+ var converter = new ReadHydraulicLoadsCalculationTypeConverter();
+
+ // Call
+ object result = converter.ConvertFrom(value);
+
+ // Assert
+ Assert.AreEqual(expectedResult, result);
+ }
+
+ [Test]
+ public void ConvertFrom_UnsupportedString_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ReadHydraulicLoadsCalculationTypeConverter();
+
+ // Call
+ TestDelegate call = () => converter.ConvertFrom("");
+
+ // Assert
+ Assert.Throws(call);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 40c3054d4339ac54e91ee80febe649f387485c6c refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/ReadSubCalculationTypeConverterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj
===================================================================
diff -u -rdb30f2625baddbc43890f324a4449a5f1125e548 -r40c3054d4339ac54e91ee80febe649f387485c6c
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.Test.csproj) (revision db30f2625baddbc43890f324a4449a5f1125e548)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.Test.csproj) (revision 40c3054d4339ac54e91ee80febe649f387485c6c)
@@ -54,7 +54,7 @@
-
+