Index: Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs =================================================================== diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -re507c88f2863ff7bc93505caf71c5f8025fb48c0 --- Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs (.../CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1) +++ Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs (.../CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs) (revision e507c88f2863ff7bc93505caf71c5f8025fb48c0) @@ -23,21 +23,22 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Reflection; using System.Security.AccessControl; using System.Text; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.IO.Configurations; using Ringtoets.Common.IO.Configurations.Export; namespace Ringtoets.Common.IO.TestUtil { [TestFixture] - public abstract class CustomCalculationConfigurationExporterDesignGuidelinesTestFixture + public abstract class CustomCalculationConfigurationExporterDesignGuidelinesTestFixture where TCalculation : class, ICalculation - where TWriter : CalculationConfigurationWriter, new() - where TCalculationConfigurationExporter : CalculationConfigurationExporter + where TWriter : CalculationConfigurationWriter + where TConfiguration : class, IConfigurationItem + where TCalculationConfigurationExporter : CalculationConfigurationExporter { [Test] public void Constructor_ConfigurationNull_ThrowArgumentNullException() @@ -46,9 +47,8 @@ TestDelegate test = () => CallConfigurationFilePathConstructor(null, "test.xml"); // Assert - var activatorException = Assert.Throws(test); - var exception = (ArgumentNullException) activatorException.InnerException; - AssertNullConfiguration(exception); + var exception = Assert.Throws(test); + AssertNullCalculations(exception); } [Test] @@ -59,8 +59,7 @@ TestDelegate test = () => CallConfigurationFilePathConstructor(Enumerable.Empty(), filePath); // Assert - var activatorException = Assert.Throws(test); - var exception = (ArgumentException) activatorException.InnerException; + var exception = Assert.Throws(test); AssertInvalidFilePath(exception); } @@ -140,16 +139,16 @@ }; } - protected virtual void AssertNullConfiguration(ArgumentNullException exception) + protected virtual void AssertNullCalculations(ArgumentNullException exception) { Assert.IsNotNull(exception); Assert.IsInstanceOf(exception); - Assert.AreEqual("configuration", exception.ParamName); + Assert.AreEqual("calculations", exception.ParamName); } protected virtual void AssertDefaultConstructedInstance(TCalculationConfigurationExporter exporter) { - Assert.IsInstanceOf>(exporter); + Assert.IsInstanceOf>(exporter); } protected virtual void AssertInvalidFilePath(ArgumentException exception) @@ -185,10 +184,6 @@ protected abstract TCalculation CreateCalculation(); - private static TCalculationConfigurationExporter CallConfigurationFilePathConstructor( - IEnumerable configuration, string filePath) - { - return (TCalculationConfigurationExporter) Activator.CreateInstance(typeof(TCalculationConfigurationExporter), configuration, filePath); - } + protected abstract TCalculationConfigurationExporter CallConfigurationFilePathConstructor(IEnumerable calculations, string filePath); } } \ No newline at end of file