Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/AssessmentSectionMergerTest.cs =================================================================== diff -u -rcdb8bb817e1731b97aa9f4198b51f6ab88e76c8d -r03733ab29bedcd18c213b3d62b87080514a9a67b --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/AssessmentSectionMergerTest.cs (.../AssessmentSectionMergerTest.cs) (revision cdb8bb817e1731b97aa9f4198b51f6ab88e76c8d) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/AssessmentSectionMergerTest.cs (.../AssessmentSectionMergerTest.cs) (revision 03733ab29bedcd18c213b3d62b87080514a9a67b) @@ -20,10 +20,12 @@ // All rights reserved. using System; +using System.Linq; using Core.Common.Gui; using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; +using Ringtoets.Integration.Data; using Ringtoets.Integration.Service.Merge; namespace Ringtoets.Integration.Plugin.Test @@ -69,7 +71,7 @@ } [Test] - public void StartMerge_FilePathNotNull_Continue() + public void GivenValidFilePath_WhenAssessmentSectionProviderReturnNull_Abort() { // Setup var mocks = new MockRepository(); @@ -88,5 +90,26 @@ TestHelper.AssertLogMessagesCount(call, 0); mocks.VerifyAll(); } + + [Test] + public void GivenValidFilePath_WhenAssessmentSectionProviderReturnEmptyCollection_LogErrorAndAbort() + { + // Setup + var mocks = new MockRepository(); + var inquiryHelper = mocks.StrictMock(); + inquiryHelper.Expect(helper => helper.GetSourceFileLocation(null)).IgnoreArguments().Return(string.Empty); + var assessmentSectionProvider = mocks.StrictMock(); + assessmentSectionProvider.Expect(asp => asp.GetAssessmentSections(null)).IgnoreArguments().Return(Enumerable.Empty()); + mocks.ReplayAll(); + + var merger = new AssessmentSectionMerger(inquiryHelper, assessmentSectionProvider); + + // Call + Action call = () => merger.StartMerge(); + + // Assert + TestHelper.AssertLogMessageWithLevelIsGenerated(call, new Tuple("Er zijn geen trajecten gevonden die samengevoegd kunnen worden.", LogLevelConstant.Error), 1); + mocks.VerifyAll(); + } } } \ No newline at end of file