Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/SchemaCalculationConfigurationWriterTest.cs =================================================================== diff -u -r43b7d2fe7b1c4209fd2afcd985a5c1f4b7bf14e9 -rd894f307cf5b3dbf88dfdb926d6a70364f2d356d --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/SchemaCalculationConfigurationWriterTest.cs (.../SchemaCalculationConfigurationWriterTest.cs) (revision 43b7d2fe7b1c4209fd2afcd985a5c1f4b7bf14e9) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/SchemaCalculationConfigurationWriterTest.cs (.../SchemaCalculationConfigurationWriterTest.cs) (revision d894f307cf5b3dbf88dfdb926d6a70364f2d356d) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -69,6 +70,39 @@ } [Test] + public void WriteDistributionWhenAvailable_MeanStandardDeviationStochastConfigurationWriterNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => ExposedSchemaCalculationConfigurationWriter.PublicWriteDistributionWhenAvailable( + null, + "some name", + (MeanStandardDeviationStochastConfiguration)null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("writer", exception.ParamName); + } + + [Test] + public void WriteDistributionWhenAvailable_MeanStandardDeviationStochastConfigurationDistributionNameNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var xmlWriter = mocks.StrictMock(); + mocks.ReplayAll(); + + // Call + TestDelegate test = () => ExposedSchemaCalculationConfigurationWriter.PublicWriteDistributionWhenAvailable( + xmlWriter, + null, + (MeanStandardDeviationStochastConfiguration)null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("distributionName", exception.ParamName); + } + + [Test] public void WriteDistributionWhenAvailable_MeanStandardDeviationStochastConfigurationNull_WriterNotCalled() { // Setup @@ -109,6 +143,39 @@ } [Test] + public void WriteDistributionWhenAvailable_MeanVariationCoefficientStochastConfigurationWriterNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => ExposedSchemaCalculationConfigurationWriter.PublicWriteDistributionWhenAvailable( + null, + "some name", + (MeanVariationCoefficientStochastConfiguration)null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("writer", exception.ParamName); + } + + [Test] + public void WriteDistributionWhenAvailable_MeanVariationCoefficientStochastConfigurationDistributionNameNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var xmlWriter = mocks.StrictMock(); + mocks.ReplayAll(); + + // Call + TestDelegate test = () => ExposedSchemaCalculationConfigurationWriter.PublicWriteDistributionWhenAvailable( + xmlWriter, + null, + (MeanVariationCoefficientStochastConfiguration)null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("distributionName", exception.ParamName); + } + + [Test] public void WriteDistributionWhenAvailable_MeanVariationCoefficientStochastConfigurationNull_WriterNotCalled() { // Setup @@ -149,6 +216,39 @@ } [Test] + public void WriteElementWhenContentAvailable_StringWriterNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => ExposedSchemaCalculationConfigurationWriter.PublicWriteElementWhenContentAvailable( + null, + "some name", + (string)null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("writer", exception.ParamName); + } + + [Test] + public void WriteElementWhenContentAvailable_StringElementNameNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var xmlWriter = mocks.StrictMock(); + mocks.ReplayAll(); + + // Call + TestDelegate test = () => ExposedSchemaCalculationConfigurationWriter.PublicWriteElementWhenContentAvailable( + xmlWriter, + null, + (string)null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("elementName", exception.ParamName); + } + + [Test] public void WriteElementWhenContentAvailable_StringNull_WriterNotCalled() { // Setup @@ -189,6 +289,39 @@ } [Test] + public void WriteElementWhenContentAvailable_DoubleWriterNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => ExposedSchemaCalculationConfigurationWriter.PublicWriteElementWhenContentAvailable( + null, + "some name", + (double?)null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("writer", exception.ParamName); + } + + [Test] + public void WriteElementWhenContentAvailable_DoubleElementNameNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var xmlWriter = mocks.StrictMock(); + mocks.ReplayAll(); + + // Call + TestDelegate test = () => ExposedSchemaCalculationConfigurationWriter.PublicWriteElementWhenContentAvailable( + xmlWriter, + null, + (double?)null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("elementName", exception.ParamName); + } + + [Test] public void WriteElementWhenContentAvailable_DoubleNull_WriterNotCalled() { // Setup @@ -229,6 +362,19 @@ } [Test] + public void WriteWaveReductionWhenAvailable_WriterNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => ExposedSchemaCalculationConfigurationWriter.PublicWriteWaveReductionWhenAvailable( + null, + null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("writer", exception.ParamName); + } + + [Test] public void WriteWaveReductionWhenAvailable_WaveReductionConfigurationNull_WriterNotCalled() { // Setup