Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.Designer.cs
===================================================================
diff -u -r5ca9ebddbe39ad92507e2f0d6b739c6e35cdb248 -rdb30f2625baddbc43890f324a4449a5f1125e548
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5ca9ebddbe39ad92507e2f0d6b739c6e35cdb248)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision db30f2625baddbc43890f324a4449a5f1125e548)
@@ -166,28 +166,27 @@
///
/// Looks up a localized string similar to norm.
///
- internal static string ReadDikeHeightCalculationTypeConverter_CalculateByAssessmentSectionNorm {
+ internal static string ReadSubCalculationTypeConverter_CalculateByAssessmentSectionNorm {
get {
- return ResourceManager.GetString("ReadDikeHeightCalculationTypeConverter_CalculateByAssessmentSectionNorm", resourceCulture);
+ return ResourceManager.GetString("ReadSubCalculationTypeConverter_CalculateByAssessmentSectionNorm", resourceCulture);
}
}
///
/// Looks up a localized string similar to doorsnede.
///
- internal static string ReadDikeHeightCalculationTypeConverter_CalculateByProfileSpecificRequiredProbability {
+ internal static string ReadSubCalculationTypeConverter_CalculateByProfileSpecificRequiredProbability {
get {
- return ResourceManager.GetString("ReadDikeHeightCalculationTypeConverter_CalculateByProfileSpecificRequiredProbabil" +
- "ity", resourceCulture);
+ return ResourceManager.GetString("ReadSubCalculationTypeConverter_CalculateByProfileSpecificRequiredProbability", resourceCulture);
}
}
///
/// Looks up a localized string similar to niet.
///
- internal static string ReadDikeHeightCalculationTypeConverter_NoCalculation {
+ internal static string ReadSubCalculationTypeConverter_NoCalculation {
get {
- return ResourceManager.GetString("ReadDikeHeightCalculationTypeConverter_NoCalculation", resourceCulture);
+ return ResourceManager.GetString("ReadSubCalculationTypeConverter_NoCalculation", resourceCulture);
}
}
}
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.resx
===================================================================
diff -u -r5ca9ebddbe39ad92507e2f0d6b739c6e35cdb248 -rdb30f2625baddbc43890f324a4449a5f1125e548
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.resx (.../Resources.resx) (revision 5ca9ebddbe39ad92507e2f0d6b739c6e35cdb248)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.resx (.../Resources.resx) (revision db30f2625baddbc43890f324a4449a5f1125e548)
@@ -121,13 +121,13 @@
..\Resources\GEKBConfiguratieSchema.xsd;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252
-
+
niet
-
+
norm
-
+
doorsnede
Fisheye: Tag db30f2625baddbc43890f324a4449a5f1125e548 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadDikeHeightCalculationTypeConverter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadSubCalculationTypeConverter.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadSubCalculationTypeConverter.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadSubCalculationTypeConverter.cs (revision db30f2625baddbc43890f324a4449a5f1125e548)
@@ -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 ReadSubCalculationTypeConverter : TypeConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if (destinationType == typeof(string))
+ {
+ var readSubCalculationType = (ReadSubCalculationType) value;
+ switch (readSubCalculationType)
+ {
+ case ReadSubCalculationType.NoCalculation:
+ return Resources.ReadSubCalculationTypeConverter_NoCalculation;
+ case ReadSubCalculationType.CalculateByAssessmentSectionNorm:
+ return Resources.ReadSubCalculationTypeConverter_CalculateByAssessmentSectionNorm;
+ case ReadSubCalculationType.CalculateByProfileSpecificRequiredProbability:
+ return Resources.ReadSubCalculationTypeConverter_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.ReadSubCalculationTypeConverter_NoCalculation)
+ {
+ return ReadSubCalculationType.NoCalculation;
+ }
+ if (text == Resources.ReadSubCalculationTypeConverter_CalculateByAssessmentSectionNorm)
+ {
+ return ReadSubCalculationType.CalculateByAssessmentSectionNorm;
+ }
+ if (text == Resources.ReadSubCalculationTypeConverter_CalculateByProfileSpecificRequiredProbability)
+ {
+ return ReadSubCalculationType.CalculateByProfileSpecificRequiredProbability;
+ }
+ }
+ return base.ConvertFrom(context, culture, value);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs
===================================================================
diff -u -re36b565a3ea45687ad9df471a655d2536b9d2a1a -rdb30f2625baddbc43890f324a4449a5f1125e548
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs (.../GrassCoverErosionInwardsCalculationConfigurationReader.cs) (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs (.../GrassCoverErosionInwardsCalculationConfigurationReader.cs) (revision db30f2625baddbc43890f324a4449a5f1125e548)
@@ -89,7 +89,7 @@
DikeProfile = calculationElement.GetStringValueFromDescendantElement(GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeProfileElement),
Orientation = calculationElement.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.Orientation),
DikeHeight = calculationElement.GetDoubleValueFromDescendantElement(GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeHeightElement),
- DikeHeightCalculationType = (ReadSubCalculationType?) calculationElement.GetConvertedValueFromDescendantStringElement(
+ DikeHeightCalculationType = (ReadSubCalculationType?) calculationElement.GetConvertedValueFromDescendantStringElement(
GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeHeightCalculationTypeElement),
UseBreakWater = calculationElement.GetBoolValueFromDescendantElement(ConfigurationSchemaIdentifiers.UseBreakWater),
BreakWaterType = (ConfigurationBreakWaterType?) calculationElement.GetConvertedValueFromDescendantStringElement(ConfigurationSchemaIdentifiers.BreakWaterType),
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj
===================================================================
diff -u -re36b565a3ea45687ad9df471a655d2536b9d2a1a -rdb30f2625baddbc43890f324a4449a5f1125e548
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.csproj) (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.csproj) (revision db30f2625baddbc43890f324a4449a5f1125e548)
@@ -45,7 +45,7 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Writers/GrassCoverErosionInwardsCalculationConfigurationWriter.cs
===================================================================
diff -u -re36b565a3ea45687ad9df471a655d2536b9d2a1a -rdb30f2625baddbc43890f324a4449a5f1125e548
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Writers/GrassCoverErosionInwardsCalculationConfigurationWriter.cs (.../GrassCoverErosionInwardsCalculationConfigurationWriter.cs) (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Writers/GrassCoverErosionInwardsCalculationConfigurationWriter.cs (.../GrassCoverErosionInwardsCalculationConfigurationWriter.cs) (revision db30f2625baddbc43890f324a4449a5f1125e548)
@@ -109,7 +109,7 @@
private static string DikeHeightCalculationTypeAsXmlString(ReadSubCalculationType type)
{
- return new ReadDikeHeightCalculationTypeConverter().ConvertToInvariantString(type);
+ return new ReadSubCalculationTypeConverter().ConvertToInvariantString(type);
}
private static void WriteWaveReduction(GrassCoverErosionInwardsInput input, XmlWriter writer)
Fisheye: Tag db30f2625baddbc43890f324a4449a5f1125e548 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/ReadDikeHeightCalculationTypeConverterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/ReadSubCalculationTypeConverterTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/ReadSubCalculationTypeConverterTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/ReadSubCalculationTypeConverterTest.cs (revision db30f2625baddbc43890f324a4449a5f1125e548)
@@ -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 ReadSubCalculationTypeConverterTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var converter = new ReadSubCalculationTypeConverter();
+
+ // Assert
+ Assert.IsInstanceOf(converter);
+ }
+
+ [Test]
+ public void CanConvertTo_String_ReturnTrue()
+ {
+ // Setup
+ var converter = new ReadSubCalculationTypeConverter();
+
+ // Call
+ bool canConvertToString = converter.CanConvertTo(typeof(string));
+
+ // Assert
+ Assert.IsTrue(canConvertToString);
+ }
+
+ [Test]
+ public void CanConvertTo_NotString_ReturnFalse()
+ {
+ // Setup
+ var converter = new ReadSubCalculationTypeConverter();
+
+ // Call
+ bool canConvert = converter.CanConvertTo(typeof(object));
+
+ // Assert
+ Assert.IsFalse(canConvert);
+ }
+
+ [Test]
+ [TestCase(ReadSubCalculationType.NoCalculation, "niet")]
+ [TestCase(ReadSubCalculationType.CalculateByAssessmentSectionNorm, "norm")]
+ [TestCase(ReadSubCalculationType.CalculateByProfileSpecificRequiredProbability, "doorsnede")]
+ public void ConvertTo_VariousCases_ReturnExpectedValues(ReadSubCalculationType value, string expectedResult)
+ {
+ // Setup
+ var converter = new ReadSubCalculationTypeConverter();
+
+ // Call
+ object result = converter.ConvertTo(value, typeof(string));
+
+ // Assert
+ Assert.AreEqual(expectedResult, result);
+ }
+
+ [Test]
+ public void ConvertTo_InvalidReadSubCalculationTypeValue_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ReadSubCalculationTypeConverter();
+
+ var invalidValue = (ReadSubCalculationType) 9999999;
+
+ // Call
+ TestDelegate call = () => converter.ConvertTo(invalidValue, typeof(string));
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void ConvertTo_Object_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ReadSubCalculationTypeConverter();
+
+ // Call
+ TestDelegate call = () => converter.ConvertTo(ReadSubCalculationType.NoCalculation, typeof(object));
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void CanConvertFrom_String_ReturnTrue()
+ {
+ // Setup
+ var converter = new ReadSubCalculationTypeConverter();
+
+ // Call
+ bool canConvertFromString = converter.CanConvertFrom(typeof(string));
+
+ // Assert
+ Assert.IsTrue(canConvertFromString);
+ }
+
+ [Test]
+ public void CanConvertFrom_NonString_ReturnFalse()
+ {
+ // Setup
+ var converter = new ReadSubCalculationTypeConverter();
+
+ // Call
+ bool canConvert = converter.CanConvertFrom(typeof(object));
+
+ // Assert
+ Assert.IsFalse(canConvert);
+ }
+
+ [Test]
+ [TestCase("niet", ReadSubCalculationType.NoCalculation)]
+ [TestCase("norm", ReadSubCalculationType.CalculateByAssessmentSectionNorm)]
+ [TestCase("doorsnede", ReadSubCalculationType.CalculateByProfileSpecificRequiredProbability)]
+ public void ConvertFrom_VariousCases_ReturnExpectedValue(string value, ReadSubCalculationType expectedResult)
+ {
+ // Setup
+ var converter = new ReadSubCalculationTypeConverter();
+
+ // Call
+ object result = converter.ConvertFrom(value);
+
+ // Assert
+ Assert.AreEqual(expectedResult, result);
+ }
+
+ [Test]
+ public void ConvertFrom_UnsupportedString_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ReadSubCalculationTypeConverter();
+
+ // Call
+ TestDelegate call = () => converter.ConvertFrom("");
+
+ // Assert
+ Assert.Throws(call);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj
===================================================================
diff -u -re36b565a3ea45687ad9df471a655d2536b9d2a1a -rdb30f2625baddbc43890f324a4449a5f1125e548
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.Test.csproj) (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.Test.csproj) (revision db30f2625baddbc43890f324a4449a5f1125e548)
@@ -54,7 +54,7 @@
-
+