Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/Helpers/ConfigurationValidationExtensionsTest.cs =================================================================== diff -u -reeac9fe0e250075e6e95683e4781b7b96ddc178c -r4e27904f8aee7ae9723f57336764c585a3b9300d --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/Helpers/ConfigurationValidationExtensionsTest.cs (.../ConfigurationValidationExtensionsTest.cs) (revision eeac9fe0e250075e6e95683e4781b7b96ddc178c) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/Helpers/ConfigurationValidationExtensionsTest.cs (.../ConfigurationValidationExtensionsTest.cs) (revision 4e27904f8aee7ae9723f57336764c585a3b9300d) @@ -42,7 +42,7 @@ const string calculationName = "calculation"; // Call - TestDelegate test = () => ((WaveReductionConfiguration)null).ValidateWaveReduction(null, calculationName, null); + TestDelegate test = () => ((WaveReductionConfiguration) null).ValidateWaveReduction(null, calculationName, null); // Assert var exception = Assert.Throws(test); @@ -58,7 +58,7 @@ mocks.ReplayAll(); // Call - TestDelegate test = () => ((WaveReductionConfiguration)null).ValidateWaveReduction(null, null, log); + TestDelegate test = () => ((WaveReductionConfiguration) null).ValidateWaveReduction(null, null, log); // Assert var exception = Assert.Throws(test); @@ -77,7 +77,7 @@ mocks.ReplayAll(); // Call - bool valid = ((WaveReductionConfiguration)null).ValidateWaveReduction(null, calculationName, log); + bool valid = ((WaveReductionConfiguration) null).ValidateWaveReduction(null, calculationName, log); // Assert Assert.IsTrue(valid); @@ -155,7 +155,7 @@ // Call bool valid = ((WaveReductionConfiguration) null).ValidateWaveReduction( new TestForeshoreProfile("voorland", Enumerable.Empty()), - calculationName, + calculationName, log); // Assert @@ -240,7 +240,7 @@ mocks.ReplayAll(); // Call - TestDelegate test = () => ((StructuresCalculationConfiguration)null).ValidateStructureBaseStochasts(log); + TestDelegate test = () => ((StructuresCalculationConfiguration) null).ValidateStructureBaseStochasts(log); // Assert var exception = Assert.Throws(test); @@ -268,24 +268,34 @@ } [Test] - public void ValidateStochasts_StormDurationWithVariationCoefficient_ReturnsFalseLogsError() + [TestCase(true, false)] + [TestCase(false, true)] + [TestCase(true, true)] + public void ValidateStochasts_StormDurationWithVariationCoefficient_ReturnsFalseLogsError(bool standardDeviation, bool variationCoefficient) { // Setup const string calculationName = "calculation"; const string expectedMessage = "{0} Berekening '{1}' is overgeslagen."; - string error = "Er kan geen variatiecoƫfficiƫnt voor stochast 'stormduur' opgegeven worden."; + string error = "Er kan geen spreiding voor stochast 'stormduur' opgegeven worden."; var mocks = new MockRepository(); var log = mocks.StrictMock(); log.Expect(l => l.ErrorFormat(expectedMessage, error, calculationName)); mocks.ReplayAll(); + var stochastConfiguration = new StochastConfiguration(); + if (standardDeviation) + { + stochastConfiguration.StandardDeviation = new Random(21).NextDouble(); + } + if (variationCoefficient) + { + stochastConfiguration.VariationCoefficient = new Random(21).NextDouble(); + } + var configuration = new TestStructuresCalculationConfiguration(calculationName) { - StormDuration = new StochastConfiguration - { - VariationCoefficient = new Random(21).NextDouble() - } + StormDuration = stochastConfiguration }; // Call @@ -321,24 +331,34 @@ } [Test] - public void ValidateStochasts_ModelFactorSuperCriticalFlowWithStandardDeviation_ReturnsFalseLogsError() + [TestCase(true, false)] + [TestCase(false, true)] + [TestCase(true, true)] + public void ValidateStochasts_ModelFactorSuperCriticalFlowWithStandardDeviation_ReturnsFalseLogsError(bool standardDeviation, bool variationCoefficient) { // Setup const string calculationName = "calculation"; const string expectedMessage = "{0} Berekening '{1}' is overgeslagen."; - string error = "Er kan geen standaardafwijking voor stochast 'modelfactoroverloopdebiet' opgegeven worden."; + string error = "Er kan geen spreiding voor stochast 'modelfactoroverloopdebiet' opgegeven worden."; var mocks = new MockRepository(); var log = mocks.StrictMock(); log.Expect(l => l.ErrorFormat(expectedMessage, error, calculationName)); mocks.ReplayAll(); + var stochastConfiguration = new StochastConfiguration(); + if (standardDeviation) + { + stochastConfiguration.StandardDeviation = new Random(21).NextDouble(); + } + if (variationCoefficient) + { + stochastConfiguration.VariationCoefficient = new Random(21).NextDouble(); + } + var configuration = new TestStructuresCalculationConfiguration(calculationName) { - ModelFactorSuperCriticalFlow = new StochastConfiguration() - { - StandardDeviation = new Random(21).NextDouble() - } + ModelFactorSuperCriticalFlow = stochastConfiguration }; // Call @@ -374,7 +394,8 @@ } } - public class TestStructuresCalculationConfiguration : StructuresCalculationConfiguration { + public class TestStructuresCalculationConfiguration : StructuresCalculationConfiguration + { public TestStructuresCalculationConfiguration(string name) : base(name) {} } } \ No newline at end of file