Index: Riskeer/Integration/src/Riskeer.Integration.IO/Exporters/AssemblyExporter.cs =================================================================== diff -u -rc94bdfa13102538f2eb1957e90daae7b9867846a -rb05dd6a7d44e624aa00510c09a7894cf7d1a593f --- Riskeer/Integration/src/Riskeer.Integration.IO/Exporters/AssemblyExporter.cs (.../AssemblyExporter.cs) (revision c94bdfa13102538f2eb1957e90daae7b9867846a) +++ Riskeer/Integration/src/Riskeer.Integration.IO/Exporters/AssemblyExporter.cs (.../AssemblyExporter.cs) (revision b05dd6a7d44e624aa00510c09a7894cf7d1a593f) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Linq; using Core.Common.Base.IO; using Core.Common.IO.Exceptions; using Core.Common.Util; @@ -66,6 +67,12 @@ public bool Export() { + if (!ValidateSpecificFailurePaths()) + { + LogErrorMessage(); + return false; + } + ExportableAssessmentSection exportableAssessmentSection = CreateExportableAssessmentSection(); if (!ValidateExportableAssessmentSection(exportableAssessmentSection)) { @@ -92,6 +99,14 @@ return true; } + private bool ValidateSpecificFailurePaths() + { + return assessmentSection.SpecificFailurePaths + .Select(fp => fp.Code) + .GroupBy(x => x) + .All(g => g.Count() == 1); + } + private ExportableAssessmentSection CreateExportableAssessmentSection() { try Index: Riskeer/Integration/test/Riskeer.Integration.IO.Test/Exporters/AssemblyExporterTest.cs =================================================================== diff -u -r6dc082582f2f24cbc09d9fec980d9c8593ca3d2e -rb05dd6a7d44e624aa00510c09a7894cf7d1a593f --- Riskeer/Integration/test/Riskeer.Integration.IO.Test/Exporters/AssemblyExporterTest.cs (.../AssemblyExporterTest.cs) (revision 6dc082582f2f24cbc09d9fec980d9c8593ca3d2e) +++ Riskeer/Integration/test/Riskeer.Integration.IO.Test/Exporters/AssemblyExporterTest.cs (.../AssemblyExporterTest.cs) (revision b05dd6a7d44e624aa00510c09a7894cf7d1a593f) @@ -87,6 +87,29 @@ } [Test] + public void Export_SpecificFailurePathsWithSameCodes_LogsErrorAndReturnsFalse() + { + // Setup + string filePath = TestHelper.GetScratchPadPath(nameof(Export_SpecificFailurePathsWithSameCodes_LogsErrorAndReturnsFalse)); + AssessmentSection assessmentSection = CreateConfiguredAssessmentSection(); + assessmentSection.SpecificFailurePaths.Last().Code = assessmentSection.SpecificFailurePaths.First().Code; + + var exporter = new AssemblyExporter(assessmentSection, filePath); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + // Call + var isExported = true; + void Call() => isExported = exporter.Export(); + + // Assert + const string expectedMessage = "Het oordeel kan niet worden geƫxporteerd. Inspecteer de resultaten van de individuele faalmechanismen voor meer details."; + TestHelper.AssertLogMessageWithLevelIsGenerated(Call, new Tuple(expectedMessage, LogLevelConstant.Error)); + Assert.IsFalse(isExported); + } + } + + [Test] public void Export_CalculatorThrowsAssemblyException_LogsErrorAndReturnsFalse() { // Setup