Fisheye: Tag e36b565a3ea45687ad9df471a655d2536b9d2a1a refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadDikeHeightCalculationType.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadDikeHeightCalculationTypeConverter.cs
===================================================================
diff -u -r56daaecf144ac21035cad0977ae4c2c8294449c0 -re36b565a3ea45687ad9df471a655d2536b9d2a1a
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadDikeHeightCalculationTypeConverter.cs (.../ReadDikeHeightCalculationTypeConverter.cs) (revision 56daaecf144ac21035cad0977ae4c2c8294449c0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadDikeHeightCalculationTypeConverter.cs (.../ReadDikeHeightCalculationTypeConverter.cs) (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
@@ -27,22 +27,22 @@
namespace Ringtoets.GrassCoverErosionInwards.IO
{
///
- /// Converts to and back.
+ /// Converts to and back.
///
public class ReadDikeHeightCalculationTypeConverter : TypeConverter
{
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(string))
{
- var readDikeHeightCalculationType = (ReadDikeHeightCalculationType) value;
- switch (readDikeHeightCalculationType)
+ var readSubCalculationType = (ReadSubCalculationType) value;
+ switch (readSubCalculationType)
{
- case ReadDikeHeightCalculationType.NoCalculation:
+ case ReadSubCalculationType.NoCalculation:
return Resources.ReadDikeHeightCalculationTypeConverter_NoCalculation;
- case ReadDikeHeightCalculationType.CalculateByAssessmentSectionNorm:
+ case ReadSubCalculationType.CalculateByAssessmentSectionNorm:
return Resources.ReadDikeHeightCalculationTypeConverter_CalculateByAssessmentSectionNorm;
- case ReadDikeHeightCalculationType.CalculateByProfileSpecificRequiredProbability:
+ case ReadSubCalculationType.CalculateByProfileSpecificRequiredProbability:
return Resources.ReadDikeHeightCalculationTypeConverter_CalculateByProfileSpecificRequiredProbability;
default:
throw new NotSupportedException();
@@ -67,15 +67,15 @@
{
if (text == Resources.ReadDikeHeightCalculationTypeConverter_NoCalculation)
{
- return ReadDikeHeightCalculationType.NoCalculation;
+ return ReadSubCalculationType.NoCalculation;
}
if (text == Resources.ReadDikeHeightCalculationTypeConverter_CalculateByAssessmentSectionNorm)
{
- return ReadDikeHeightCalculationType.CalculateByAssessmentSectionNorm;
+ return ReadSubCalculationType.CalculateByAssessmentSectionNorm;
}
if (text == Resources.ReadDikeHeightCalculationTypeConverter_CalculateByProfileSpecificRequiredProbability)
{
- return ReadDikeHeightCalculationType.CalculateByProfileSpecificRequiredProbability;
+ return ReadSubCalculationType.CalculateByProfileSpecificRequiredProbability;
}
}
return base.ConvertFrom(context, culture, value);
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadSubCalculationType.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadSubCalculationType.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/ReadSubCalculationType.cs (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
@@ -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.GrassCoverErosionInwards.IO
+{
+ ///
+ /// Defines the various types of sub calculations in a read calculation configuration.
+ ///
+ public enum ReadSubCalculationType
+ {
+ ///
+ /// No calculation.
+ ///
+ NoCalculation = 1,
+
+ ///
+ /// Calculate by using the norm on assessment section.
+ ///
+ CalculateByAssessmentSectionNorm = 2,
+
+ ///
+ /// Calculate using the probability of the specific profile.
+ ///
+ CalculateByProfileSpecificRequiredProbability = 3
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs
===================================================================
diff -u -rc1108c0cdbd9bc24cc712e6fcab78719b0ea5aec -re36b565a3ea45687ad9df471a655d2536b9d2a1a
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs (.../GrassCoverErosionInwardsCalculationConfigurationReader.cs) (revision c1108c0cdbd9bc24cc712e6fcab78719b0ea5aec)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs (.../GrassCoverErosionInwardsCalculationConfigurationReader.cs) (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
@@ -89,7 +89,7 @@
DikeProfile = calculationElement.GetStringValueFromDescendantElement(GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeProfileElement),
Orientation = calculationElement.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.Orientation),
DikeHeight = calculationElement.GetDoubleValueFromDescendantElement(GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeHeightElement),
- DikeHeightCalculationType = (ReadDikeHeightCalculationType?) 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/Readers/ReadGrassCoverErosionInwardsCalculation.cs
===================================================================
diff -u -r8963d5e5c4a22feba25c4e936e6b67de7104cccd -re36b565a3ea45687ad9df471a655d2536b9d2a1a
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/ReadGrassCoverErosionInwardsCalculation.cs (.../ReadGrassCoverErosionInwardsCalculation.cs) (revision 8963d5e5c4a22feba25c4e936e6b67de7104cccd)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/ReadGrassCoverErosionInwardsCalculation.cs (.../ReadGrassCoverErosionInwardsCalculation.cs) (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
@@ -20,9 +20,7 @@
// All rights reserved.
using System;
-using Ringtoets.Common.IO;
using Ringtoets.Common.IO.Configurations;
-using Ringtoets.Common.IO.Readers;
namespace Ringtoets.GrassCoverErosionInwards.IO.Readers
{
@@ -85,7 +83,7 @@
/// Gets the value for how the dike height should be calculated for the grass cover
/// erosion inwards calculation.
///
- public ReadDikeHeightCalculationType? DikeHeightCalculationType { get; }
+ public ReadSubCalculationType? DikeHeightCalculationType { get; }
///
/// Gets the value indicating if the break water for the grass cover erosion inwards
@@ -156,7 +154,7 @@
///
/// Gets or sets the value for .
///
- public ReadDikeHeightCalculationType? DikeHeightCalculationType { get; set; }
+ public ReadSubCalculationType? DikeHeightCalculationType { get; set; }
///
/// Gets or sets the value for .
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj
===================================================================
diff -u -r335523a40d190e19b1061804de21c28f74140f52 -re36b565a3ea45687ad9df471a655d2536b9d2a1a
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.csproj) (revision 335523a40d190e19b1061804de21c28f74140f52)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.csproj) (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
@@ -49,7 +49,7 @@
-
+
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Writers/GrassCoverErosionInwardsCalculationConfigurationWriter.cs
===================================================================
diff -u -rc1108c0cdbd9bc24cc712e6fcab78719b0ea5aec -re36b565a3ea45687ad9df471a655d2536b9d2a1a
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Writers/GrassCoverErosionInwardsCalculationConfigurationWriter.cs (.../GrassCoverErosionInwardsCalculationConfigurationWriter.cs) (revision c1108c0cdbd9bc24cc712e6fcab78719b0ea5aec)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Writers/GrassCoverErosionInwardsCalculationConfigurationWriter.cs (.../GrassCoverErosionInwardsCalculationConfigurationWriter.cs) (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
@@ -50,7 +50,7 @@
writer.WriteElementString(
GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeHeightCalculationTypeElement,
- DikeHeightCalculationTypeAsXmlString((ReadDikeHeightCalculationType) input.DikeHeightCalculationType));
+ DikeHeightCalculationTypeAsXmlString((ReadSubCalculationType) input.DikeHeightCalculationType));
WriteWaveReduction(input, writer);
@@ -107,7 +107,7 @@
XmlConvert.ToString(input.DikeHeight));
}
- private static string DikeHeightCalculationTypeAsXmlString(ReadDikeHeightCalculationType type)
+ private static string DikeHeightCalculationTypeAsXmlString(ReadSubCalculationType type)
{
return new ReadDikeHeightCalculationTypeConverter().ConvertToInvariantString(type);
}
Fisheye: Tag e36b565a3ea45687ad9df471a655d2536b9d2a1a refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/ReadDikeHeightCalculationConverterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/ReadDikeHeightCalculationTypeConverterTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/ReadDikeHeightCalculationTypeConverterTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/ReadDikeHeightCalculationTypeConverterTest.cs (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
@@ -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 ReadDikeHeightCalculationTypeConverterTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var converter = new ReadDikeHeightCalculationTypeConverter();
+
+ // Assert
+ Assert.IsInstanceOf(converter);
+ }
+
+ [Test]
+ public void CanConvertTo_String_ReturnTrue()
+ {
+ // Setup
+ var converter = new ReadDikeHeightCalculationTypeConverter();
+
+ // Call
+ bool canConvertToString = converter.CanConvertTo(typeof(string));
+
+ // Assert
+ Assert.IsTrue(canConvertToString);
+ }
+
+ [Test]
+ public void CanConvertTo_NotString_ReturnFalse()
+ {
+ // Setup
+ var converter = new ReadDikeHeightCalculationTypeConverter();
+
+ // 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 ReadDikeHeightCalculationTypeConverter();
+
+ // Call
+ object result = converter.ConvertTo(value, typeof(string));
+
+ // Assert
+ Assert.AreEqual(expectedResult, result);
+ }
+
+ [Test]
+ public void ConvertTo_InvalidReadSubCalculationTypeValue_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ReadDikeHeightCalculationTypeConverter();
+
+ 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 ReadDikeHeightCalculationTypeConverter();
+
+ // Call
+ TestDelegate call = () => converter.ConvertTo(ReadSubCalculationType.NoCalculation, typeof(object));
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void CanConvertFrom_String_ReturnTrue()
+ {
+ // Setup
+ var converter = new ReadDikeHeightCalculationTypeConverter();
+
+ // Call
+ bool canConvertFromString = converter.CanConvertFrom(typeof(string));
+
+ // Assert
+ Assert.IsTrue(canConvertFromString);
+ }
+
+ [Test]
+ public void CanConvertFrom_NonString_ReturnFalse()
+ {
+ // Setup
+ var converter = new ReadDikeHeightCalculationTypeConverter();
+
+ // 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 ReadDikeHeightCalculationTypeConverter();
+
+ // Call
+ object result = converter.ConvertFrom(value);
+
+ // Assert
+ Assert.AreEqual(expectedResult, result);
+ }
+
+ [Test]
+ public void ConvertFrom_UnsupportedString_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ReadDikeHeightCalculationTypeConverter();
+
+ // Call
+ TestDelegate call = () => converter.ConvertFrom("");
+
+ // Assert
+ Assert.Throws(call);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/GrassCoverErosionInwardsCalculationConfigurationReaderTest.cs
===================================================================
diff -u -r4ddd71e94c1499cdbcbdaa13295ece84f2070411 -re36b565a3ea45687ad9df471a655d2536b9d2a1a
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/GrassCoverErosionInwardsCalculationConfigurationReaderTest.cs (.../GrassCoverErosionInwardsCalculationConfigurationReaderTest.cs) (revision 4ddd71e94c1499cdbcbdaa13295ece84f2070411)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/GrassCoverErosionInwardsCalculationConfigurationReaderTest.cs (.../GrassCoverErosionInwardsCalculationConfigurationReaderTest.cs) (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
@@ -312,7 +312,7 @@
Assert.AreEqual("some_dike_profile", calculation.DikeProfile);
Assert.AreEqual(67.1, calculation.Orientation);
Assert.AreEqual(3.45, calculation.DikeHeight);
- Assert.AreEqual(ReadDikeHeightCalculationType.CalculateByAssessmentSectionNorm, calculation.DikeHeightCalculationType);
+ Assert.AreEqual(ReadSubCalculationType.CalculateByAssessmentSectionNorm, calculation.DikeHeightCalculationType);
Assert.AreEqual(true, calculation.UseBreakWater);
Assert.AreEqual(ConfigurationBreakWaterType.Dam, calculation.BreakWaterType);
Assert.AreEqual(1.234, calculation.BreakWaterHeight);
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/ReadGrassCoverErosionInwardsCalculationTest.cs
===================================================================
diff -u -r8963d5e5c4a22feba25c4e936e6b67de7104cccd -re36b565a3ea45687ad9df471a655d2536b9d2a1a
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/ReadGrassCoverErosionInwardsCalculationTest.cs (.../ReadGrassCoverErosionInwardsCalculationTest.cs) (revision 8963d5e5c4a22feba25c4e936e6b67de7104cccd)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/ReadGrassCoverErosionInwardsCalculationTest.cs (.../ReadGrassCoverErosionInwardsCalculationTest.cs) (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
@@ -21,9 +21,7 @@
using System;
using NUnit.Framework;
-using Ringtoets.Common.IO;
using Ringtoets.Common.IO.Configurations;
-using Ringtoets.Common.IO.Readers;
using Ringtoets.GrassCoverErosionInwards.IO.Readers;
namespace Ringtoets.GrassCoverErosionInwards.IO.Test.Readers
@@ -74,7 +72,7 @@
const string dikeProfileName = "name of the dike profile";
const double orientation = 1.1;
const double dikeHeight = 2.2;
- const ReadDikeHeightCalculationType calculationType = ReadDikeHeightCalculationType.CalculateByAssessmentSectionNorm;
+ const ReadSubCalculationType calculationType = ReadSubCalculationType.CalculateByAssessmentSectionNorm;
const bool useBreakWater = true;
const ConfigurationBreakWaterType breakWaterType = ConfigurationBreakWaterType.Wall;
const double breakWaterHeight = 3.3;
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj
===================================================================
diff -u -r56daaecf144ac21035cad0977ae4c2c8294449c0 -re36b565a3ea45687ad9df471a655d2536b9d2a1a
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.Test.csproj) (revision 56daaecf144ac21035cad0977ae4c2c8294449c0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.Test.csproj) (revision e36b565a3ea45687ad9df471a655d2536b9d2a1a)
@@ -54,7 +54,7 @@
-
+