Fisheye: Tag 53c9fa4450ca27bd61c3bec0c980b2737aaf455d refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.IO.Test/BreakWaterTypeConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Readers/ReadBreakWaterTypeConverterTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Readers/ReadBreakWaterTypeConverterTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Readers/ReadBreakWaterTypeConverterTest.cs (revision 53c9fa4450ca27bd61c3bec0c980b2737aaf455d) @@ -0,0 +1,156 @@ +// 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.IO.Readers; +using Ringtoets.Common.IO.Schema; + +namespace Ringtoets.Common.IO.Test.Readers +{ + [TestFixture] + public class ReadBreakWaterTypeConverterTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var converter = new ReadBreakWaterTypeConverter(); + + // Assert + Assert.IsInstanceOf(converter); + } + + [Test] + public void CanConvertTo_String_ReturnTrue() + { + // Setup + var converter = new ReadBreakWaterTypeConverter(); + + // Call + bool canConvertToString = converter.CanConvertTo(typeof(string)); + + // Assert + Assert.IsTrue(canConvertToString); + } + + [Test] + public void CanConvertTo_OtherThanString_ReturnFalse() + { + // Setup + var converter = new ReadBreakWaterTypeConverter(); + + // Call + bool canConvertToString = converter.CanConvertTo(typeof(object)); + + // Assert + Assert.IsFalse(canConvertToString); + } + + [Test] + [TestCase(ReadBreakWaterType.Caisson, ConfigurationSchemaIdentifiers.BreakWaterCaisson)] + [TestCase(ReadBreakWaterType.Dam, ConfigurationSchemaIdentifiers.BreakWaterDam)] + [TestCase(ReadBreakWaterType.Wall, ConfigurationSchemaIdentifiers.BreakWaterWall)] + public void ConverTo_VariousCases_ReturnExpectedText(ReadBreakWaterType value, + string expectedResult) + { + // Setup + var converter = new ReadBreakWaterTypeConverter(); + + // Call + object result = converter.ConvertTo(value, typeof(string)); + + // Assert + Assert.AreEqual(expectedResult, result); + } + + [Test] + public void ConvertTo_InvalidBreakWaterType_ThrowNotSupportedException() + { + // Setup + var converter = new ReadBreakWaterTypeConverter(); + var invalidValue = (ReadBreakWaterType) 99999999; + + // Call + TestDelegate call = () => converter.ConvertTo(invalidValue, typeof(string)); + + // Assert + Assert.Throws(call); + } + + [Test] + public void CanConvertFrom_String_ReturnTrue() + { + // Setup + var converter = new ReadBreakWaterTypeConverter(); + + // Call + bool canConvertFromString = converter.CanConvertFrom(typeof(string)); + + // Assert + Assert.IsTrue(canConvertFromString); + } + + [Test] + public void CanConvertFrom_OtherThanString_ReturnFalse() + { + // Setup + var converter = new ReadBreakWaterTypeConverter(); + + // Call + bool canConvertFromString = converter.CanConvertFrom(typeof(object)); + + // Assert + Assert.IsFalse(canConvertFromString); + } + + [Test] + [TestCase(ConfigurationSchemaIdentifiers.BreakWaterCaisson, ReadBreakWaterType.Caisson)] + [TestCase(ConfigurationSchemaIdentifiers.BreakWaterDam, ReadBreakWaterType.Dam)] + [TestCase(ConfigurationSchemaIdentifiers.BreakWaterWall, ReadBreakWaterType.Wall)] + public void ConvertFrom_Text_ReturnExpectedBreakWaterType(string value, + ReadBreakWaterType expectedResult) + { + // Setup + var converter = new ReadBreakWaterTypeConverter(); + + // Call + object result = converter.ConvertFrom(value); + + // Assert + Assert.AreEqual(expectedResult, result); + } + + [Test] + public void ConvertFrom_InvalidText_ThrowNotSupportedException() + { + // Setup + var converter = new ReadBreakWaterTypeConverter(); + + // Call + TestDelegate call = () => converter.ConvertFrom("A"); + + // Assert + Assert.Throws(call); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj =================================================================== diff -u -r236569ca4c1124cdd32203da577aa4156eb4020e -r53c9fa4450ca27bd61c3bec0c980b2737aaf455d --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 236569ca4c1124cdd32203da577aa4156eb4020e) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 53c9fa4450ca27bd61c3bec0c980b2737aaf455d) @@ -59,7 +59,7 @@ - + Fisheye: Tag 53c9fa4450ca27bd61c3bec0c980b2737aaf455d refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/DikeHeightCalculationConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/ReadDikeHeightCalculationConverterTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/ReadDikeHeightCalculationConverterTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Readers/ReadDikeHeightCalculationConverterTest.cs (revision 53c9fa4450ca27bd61c3bec0c980b2737aaf455d) @@ -0,0 +1,167 @@ +// 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.GrassCoverErosionInwards.IO.Readers; + +namespace Ringtoets.GrassCoverErosionInwards.IO.Test.Readers +{ + [TestFixture] + public class ReadDikeHeightCalculationConverterTest + { + [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(ReadDikeHeightCalculationType.NoCalculation, "niet")] + [TestCase(ReadDikeHeightCalculationType.CalculateByAssessmentSectionNorm, "norm")] + [TestCase(ReadDikeHeightCalculationType.CalculateByProfileSpecificRequiredProbability, "doorsnede")] + public void ConvertTo_VariousCases_ReturnExpectedValues(ReadDikeHeightCalculationType 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_InvalidDikeHeightCalculationTypeValue_ThrowNotSupportedException() + { + // Setup + var converter = new ReadDikeHeightCalculationTypeConverter(); + + var invalidValue = (ReadDikeHeightCalculationType) 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(ReadDikeHeightCalculationType.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", ReadDikeHeightCalculationType.NoCalculation)] + [TestCase("norm", ReadDikeHeightCalculationType.CalculateByAssessmentSectionNorm)] + [TestCase("doorsnede", ReadDikeHeightCalculationType.CalculateByProfileSpecificRequiredProbability)] + public void ConvertFrom_VariousCases_ReturnExpectedValue(string value, ReadDikeHeightCalculationType 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/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj =================================================================== diff -u -r1144837cd4defc65250e08e83d9ab8583324e21b -r53c9fa4450ca27bd61c3bec0c980b2737aaf455d --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.Test.csproj) (revision 1144837cd4defc65250e08e83d9ab8583324e21b) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.Test.csproj) (revision 53c9fa4450ca27bd61c3bec0c980b2737aaf455d) @@ -54,7 +54,7 @@ - + Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Readers/ReadWaveConditionsInputStepSizeTypeConverterTest.cs =================================================================== diff -u --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Readers/ReadWaveConditionsInputStepSizeTypeConverterTest.cs (revision 0) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Readers/ReadWaveConditionsInputStepSizeTypeConverterTest.cs (revision 53c9fa4450ca27bd61c3bec0c980b2737aaf455d) @@ -0,0 +1,176 @@ +// 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 NUnit.Framework; +using Ringtoets.Revetment.IO.Readers; + +namespace Ringtoets.Revetment.IO.Test.Readers +{ + [TestFixture] + public class ReadWaveConditionsInputStepSizeTypeConverterTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var converter = new ReadWaveConditionsInputStepSizeConverter(); + + // Assert + Assert.IsInstanceOf(converter); + } + + [Test] + public void CanConvertTo_String_ReturnTrue() + { + // Setup + var converter = new ReadWaveConditionsInputStepSizeConverter(); + + // Call + bool canConvertToString = converter.CanConvertTo(typeof(string)); + + // Assert + Assert.IsTrue(canConvertToString); + } + + [Test] + public void CanConvertTo_OtherTypeThenString_ReturnFalse() + { + // Setup + var converter = new ReadWaveConditionsInputStepSizeConverter(); + + // Call + bool canConvertToNonString = converter.CanConvertTo(typeof(object)); + + // Assert + Assert.IsFalse(canConvertToNonString); + } + + [Test] + [SetCulture("nl-NL")] + [TestCase(ReadWaveConditionsInputStepSize.Half, "0,5")] + [TestCase(ReadWaveConditionsInputStepSize.One, "1,0")] + [TestCase(ReadWaveConditionsInputStepSize.Two, "2,0")] + public void ConvertTo_ForAllEnumValues_ReturnExpectedText(ReadWaveConditionsInputStepSize value, + string expectedText) + { + // Setup + var converter = new ReadWaveConditionsInputStepSizeConverter(); + + // Call + object result = converter.ConvertTo(null, CultureInfo.CurrentCulture, value, typeof(string)); + + // Assert + Assert.AreEqual(expectedText, result); + } + + [Test] + public void ConvertTo_Object_ThrowNotSupportedException() + { + // Setup + var converter = new ReadWaveConditionsInputStepSizeConverter(); + + // Call + TestDelegate call = () => converter.ConvertTo(ReadWaveConditionsInputStepSize.Half, typeof(object)); + + // Assert + Assert.Throws(call); + } + + [Test] + public void CanConvertFrom_String_ReturnTrue() + { + // Setup + var converter = new ReadWaveConditionsInputStepSizeConverter(); + + // Call + bool canConvertFromString = converter.CanConvertFrom(typeof(string)); + + // Assert + Assert.IsTrue(canConvertFromString); + } + + [Test] + public void CanConvertFrom_NonString_ReturnFalse() + { + // Setup + var converter = new ReadWaveConditionsInputStepSizeConverter(); + + // Call + bool canConvertFromString = converter.CanConvertFrom(typeof(object)); + + // Assert + Assert.IsFalse(canConvertFromString); + } + + [Test] + [SetCulture("nl-NL")] + [TestCase("0,5", ReadWaveConditionsInputStepSize.Half)] + [TestCase("1,0", ReadWaveConditionsInputStepSize.One)] + [TestCase("2,0", ReadWaveConditionsInputStepSize.Two)] + public void ConvertFrom_VariousCasesInCultureNL_ReturnWaveConditionsInputStepSize(string text, + ReadWaveConditionsInputStepSize expectedResult) + { + // Setup + var converter = new ReadWaveConditionsInputStepSizeConverter(); + + // Call + object result = converter.ConvertFrom(null, CultureInfo.CurrentCulture, text); + + // Assert + Assert.AreEqual(expectedResult, result); + } + + [Test] + [SetCulture("en-US")] + [TestCase("0.5", ReadWaveConditionsInputStepSize.Half)] + [TestCase("1.0", ReadWaveConditionsInputStepSize.One)] + [TestCase("2.0", ReadWaveConditionsInputStepSize.Two)] + public void ConvertFrom_VariousCasesInCultureEN_ReturnWaveConditionsInputStepSize(string text, + ReadWaveConditionsInputStepSize expectedResult) + { + // Setup + var converter = new ReadWaveConditionsInputStepSizeConverter(); + + // Call + object result = converter.ConvertFrom(null, CultureInfo.CurrentCulture, text); + + // Assert + Assert.AreEqual(expectedResult, result); + } + + [Test] + [SetCulture("nl-NL")] + public void ConvertFrom_InvalidText_ThrowNotSupportedException() + { + // Setup + var converter = new ReadWaveConditionsInputStepSizeConverter(); + + // Call + TestDelegate call = () => converter.ConvertFrom("1"); + + // Assert + Assert.Throws(call); + } + } +} \ No newline at end of file Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Ringtoets.Revetment.IO.Test.csproj =================================================================== diff -u -rb2288a6eae1568001c17d9ce7aaa5521a44595f2 -r53c9fa4450ca27bd61c3bec0c980b2737aaf455d --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Ringtoets.Revetment.IO.Test.csproj (.../Ringtoets.Revetment.IO.Test.csproj) (revision b2288a6eae1568001c17d9ce7aaa5521a44595f2) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Ringtoets.Revetment.IO.Test.csproj (.../Ringtoets.Revetment.IO.Test.csproj) (revision 53c9fa4450ca27bd61c3bec0c980b2737aaf455d) @@ -60,7 +60,7 @@ - + Fisheye: Tag 53c9fa4450ca27bd61c3bec0c980b2737aaf455d refers to a dead (removed) revision in file `Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditionsInputStepSizeTypeConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff?