Index: Riskeer/Common/test/Riskeer.Common.IO.TestUtil/CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs =================================================================== diff -u -rc4311504aa83ba59c5a7e80c0e9bc26650986c05 -r8b7975cbb66219fd9c92aef85689e86264545ac8 --- Riskeer/Common/test/Riskeer.Common.IO.TestUtil/CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs (.../CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs) (revision c4311504aa83ba59c5a7e80c0e9bc26650986c05) +++ Riskeer/Common/test/Riskeer.Common.IO.TestUtil/CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs (.../CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs) (revision 8b7975cbb66219fd9c92aef85689e86264545ac8) @@ -46,22 +46,22 @@ public void Constructor_CalculationsNull_ThrowArgumentNullException() { // Call - TestDelegate test = () => CallConfigurationFilePathConstructor(null, "test.xml"); + void Call() => CallConfigurationFilePathConstructor(null, "test.xml"); // Assert - var exception = Assert.Throws(test); - AssertNullCalculations(exception); + var exception = Assert.Throws(Call); + Assert.AreEqual("calculations", exception.ParamName); } [Test] [TestCaseSource(typeof(InvalidPathHelper), nameof(InvalidPathHelper.InvalidPaths))] public void Constructor_FilePathInvalid_ThrowArgumentException(string filePath) { // Call - TestDelegate test = () => CallConfigurationFilePathConstructor(Enumerable.Empty(), filePath); + void Call() => CallConfigurationFilePathConstructor(Enumerable.Empty(), filePath); // Assert - Assert.Throws(test); + Assert.Throws(Call); } [Test] @@ -71,7 +71,7 @@ TCalculationConfigurationExporter exporter = CallConfigurationFilePathConstructor(Enumerable.Empty(), "test.xml"); // Assert - AssertDefaultConstructedInstance(exporter); + Assert.IsInstanceOf>(exporter); } [Test] @@ -93,11 +93,11 @@ // Call var isExported = true; - Action call = () => isExported = exporter.Export(); + void Call() => isExported = exporter.Export(); // Assert IEnumerable> logMessages = GetExpectedExportFailedLogMessages(filePath); - TestHelper.AssertLogMessagesWithLevelAreGenerated(call, logMessages); + TestHelper.AssertLogMessagesWithLevelAreGenerated(Call, logMessages); Assert.IsFalse(isExported); } } @@ -122,15 +122,15 @@ // Call var isExported = true; - Action call = () => isExported = exporter.Export(); + void Call() => isExported = exporter.Export(); // Assert IEnumerable> logMessages = GetExpectedExportFailedLogMessages(filePath); - TestHelper.AssertLogMessagesWithLevelAreGenerated(call, logMessages); + TestHelper.AssertLogMessagesWithLevelAreGenerated(Call, logMessages); Assert.IsFalse(isExported); } - protected virtual IEnumerable> GetExpectedExportFailedLogMessages(string filePath) + private static IEnumerable> GetExpectedExportFailedLogMessages(string filePath) { return new[] { @@ -140,18 +140,6 @@ }; } - protected virtual void AssertNullCalculations(ArgumentNullException exception) - { - Assert.IsNotNull(exception); - Assert.IsInstanceOf(exception); - Assert.AreEqual("calculations", exception.ParamName); - } - - protected virtual void AssertDefaultConstructedInstance(TCalculationConfigurationExporter exporter) - { - Assert.IsInstanceOf>(exporter); - } - protected void WriteAndValidate(IEnumerable configuration, string expectedXmlFilePath) { string filePath = TestHelper.GetScratchPadPath($"{nameof(TCalculationConfigurationExporter)}.{nameof(WriteAndValidate)}.xml");