Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/GeneralResultTest.cs =================================================================== diff -u -r268c1647f0094f6c43aeceaa5793437562cffe5a -re0c69303985f5ad57106c5b7f18700d1a16ae3b3 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/GeneralResultTest.cs (.../GeneralResultTest.cs) (revision 268c1647f0094f6c43aeceaa5793437562cffe5a) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/GeneralResultTest.cs (.../GeneralResultTest.cs) (revision e0c69303985f5ad57106c5b7f18700d1a16ae3b3) @@ -103,6 +103,58 @@ } [Test] + public void Constructor_StochastNotUnique_ThrowArgumentException() + { + // Setup + WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection(); + var stochasts = new[] + { + new Stochast("unique", 0, 0), + new Stochast("non-unique", 0, 0), + new Stochast("non-unique", 0, 0), + new Stochast("nonunique", 0, 0), + new Stochast("nonunique", 0, 0) + }; + IEnumerable topLevelIllustrationPoints = + Enumerable.Empty(); + + // Call + TestDelegate test = () => new GeneralResult(windDirection, + stochasts, + topLevelIllustrationPoints); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Een of meerdere stochasten hebben dezelfde naam. " + + "Het uitlezen van illustratiepunten wordt overgeslagen.", + exception.Message); + } + + [Test] + public void Constructor_IllustrationPointsNotUnique_ThrowArgumentException() + { + // Setup + WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection(); + IEnumerable stochasts = Enumerable.Empty(); + IEnumerable topLevelIllustrationPoints = new[] + { + new TopLevelIllustrationPoint(new WindDirection("N", 0.5), "not unique"), + new TopLevelIllustrationPoint(new WindDirection("N", 0.5), "not unique") + }; + + // Call + TestDelegate test = () => new GeneralResult(windDirection, + stochasts, + topLevelIllustrationPoints); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Een of meerdere illustratiepunten hebben dezelfde sluitscenario en windrichting. " + + "Het uitlezen van illustratiepunten wordt overgeslagen.", + exception.Message); + } + + [Test] public void Clone_Always_ReturnNewInstanceWithCopiedValues() { // Setup @@ -119,8 +171,8 @@ }, new[] { - new TestTopLevelIllustrationPoint(), - new TestTopLevelIllustrationPoint() + new TestTopLevelIllustrationPoint("situation 1"), + new TestTopLevelIllustrationPoint("situation 2") }); // Call @@ -129,5 +181,11 @@ // Assert CoreCloneAssert.AreObjectClones(original, clone, CommonCloneAssert.AreClones); } + + private class TopLevelIllustrationPoint : TopLevelIllustrationPointBase + { + public TopLevelIllustrationPoint(WindDirection windDirection, string closingSituation) + : base(windDirection, closingSituation) {} + } } } \ No newline at end of file