Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/Helpers/ConfigurationValidationExtensionsTest.cs =================================================================== diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r7e9c5360c08230addd99e35e03706d401e6e1e12 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/Helpers/ConfigurationValidationExtensionsTest.cs (.../ConfigurationValidationExtensionsTest.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/Helpers/ConfigurationValidationExtensionsTest.cs (.../ConfigurationValidationExtensionsTest.cs) (revision 7e9c5360c08230addd99e35e03706d401e6e1e12) @@ -216,191 +216,5 @@ Assert.IsFalse(valid); mocks.VerifyAll(); } - - [Test] - public void ValidateStochasts_NoLog_ThrowsArgumentNullException() - { - // Setup - const string calculationName = "calculation"; - - // Call - TestDelegate test = () => new TestStructuresCalculationConfiguration(calculationName).ValidateStructureBaseStochasts(null); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("log", exception.ParamName); - } - - [Test] - public void ValidateStochasts_NoConfiguration_ThrowsArgumentNullException() - { - // Setup - var mocks = new MockRepository(); - var log = mocks.StrictMock(); - mocks.ReplayAll(); - - // Call - TestDelegate test = () => ((StructuresCalculationConfiguration) null).ValidateStructureBaseStochasts(log); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("configuration", exception.ParamName); - mocks.VerifyAll(); - } - - [Test] - public void ValidateStochasts_ConfigurationWithoutStochasts_ReturnsTrue() - { - // Setup - const string calculationName = "calculation"; - - var mocks = new MockRepository(); - var log = mocks.StrictMock(); - mocks.ReplayAll(); - - var configuration = new TestStructuresCalculationConfiguration(calculationName); - - // Call - bool valid = configuration.ValidateStructureBaseStochasts(log); - - // Assert - Assert.IsTrue(valid); - mocks.VerifyAll(); - } - - [Test] - [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."; - const 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 = stochastConfiguration - }; - - // Call - bool valid = configuration.ValidateStructureBaseStochasts(log); - - // Assert - Assert.IsFalse(valid); - mocks.VerifyAll(); - } - - [Test] - public void ValidateStochasts_StormDurationWithMean_ReturnsTrue() - { - // Setup - const string calculationName = "calculation"; - - var mocks = new MockRepository(); - var log = mocks.StrictMock(); - mocks.ReplayAll(); - - var configuration = new TestStructuresCalculationConfiguration(calculationName) - { - StormDuration = new StochastConfiguration - { - Mean = new Random(21).NextDouble() - } - }; - - // Call - bool valid = configuration.ValidateStructureBaseStochasts(log); - - // Assert - Assert.IsTrue(valid); - mocks.VerifyAll(); - } - - [Test] - [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."; - const 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 = stochastConfiguration - }; - - // Call - bool valid = configuration.ValidateStructureBaseStochasts(log); - - // Assert - Assert.IsFalse(valid); - mocks.VerifyAll(); - } - - [Test] - public void ValidateStochasts_ModelFactorSuperCriticalFlowWithMean_ReturnsTrue() - { - // Setup - const string calculationName = "calculation"; - - var mocks = new MockRepository(); - var log = mocks.StrictMock(); - mocks.ReplayAll(); - - var configuration = new TestStructuresCalculationConfiguration(calculationName) - { - ModelFactorSuperCriticalFlow = new StochastConfiguration - { - Mean = new Random(21).NextDouble() - } - }; - - // Call - bool valid = configuration.ValidateStructureBaseStochasts(log); - - // Assert - Assert.IsTrue(valid); - mocks.VerifyAll(); - } - - private class TestStructuresCalculationConfiguration : StructuresCalculationConfiguration - { - public TestStructuresCalculationConfiguration(string name) : base(name) {} - } } } \ No newline at end of file