Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Ringtoets.ClosingStructures.Forms.csproj =================================================================== diff -u -r9fffdfe86ac1685eb9369e2190c26181e3613cb1 -r8c76ed44224c5f2e96bd030b00c9bb8565e71330 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Ringtoets.ClosingStructures.Forms.csproj (.../Ringtoets.ClosingStructures.Forms.csproj) (revision 9fffdfe86ac1685eb9369e2190c26181e3613cb1) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Ringtoets.ClosingStructures.Forms.csproj (.../Ringtoets.ClosingStructures.Forms.csproj) (revision 8c76ed44224c5f2e96bd030b00c9bb8565e71330) @@ -62,6 +62,7 @@ UserControl + UserControl @@ -110,6 +111,11 @@ Ringtoets.ClosingStructures.Data False + + {09A12A95-370D-42FE-B18E-32821D7A62BA} + Ringtoets.ClosingStructures.Utils + False + Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresScenarioRow.cs =================================================================== diff -u --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresScenarioRow.cs (revision 0) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresScenarioRow.cs (revision 8c76ed44224c5f2e96bd030b00c9bb8565e71330) @@ -0,0 +1,71 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.ClosingStructures.Data; +using Ringtoets.Common.Forms; + +namespace Ringtoets.ClosingStructures.Forms.Views +{ + /// + /// Container of a , + /// which takes care of the representation of properties in a grid. + /// + public class ClosingStructuresScenarioRow : IScenarioRow + { + private readonly ClosingStructuresFailureMechanismSectionResult sectionResult; + + /// + /// Initializes a new instance of the class. + /// + /// The section result. + /// Thrown when is null. + public ClosingStructuresScenarioRow(ClosingStructuresFailureMechanismSectionResult sectionResult) + { + if (sectionResult == null) + { + throw new ArgumentNullException("sectionResult"); + } + this.sectionResult = sectionResult; + } + + public string Name + { + get + { + return sectionResult.Section.Name; + } + } + + public ClosingStructuresCalculation Calculation + { + get + { + return sectionResult.Calculation; + } + set + { + sectionResult.Calculation = value; + sectionResult.NotifyObservers(); + } + } + } +} \ No newline at end of file Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Ringtoets.ClosingStructures.Forms.Test.csproj =================================================================== diff -u -r83024e3b1086e1dba93b83df874bd4781f67aa63 -r8c76ed44224c5f2e96bd030b00c9bb8565e71330 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Ringtoets.ClosingStructures.Forms.Test.csproj (.../Ringtoets.ClosingStructures.Forms.Test.csproj) (revision 83024e3b1086e1dba93b83df874bd4781f67aa63) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Ringtoets.ClosingStructures.Forms.Test.csproj (.../Ringtoets.ClosingStructures.Forms.Test.csproj) (revision 8c76ed44224c5f2e96bd030b00c9bb8565e71330) @@ -80,6 +80,7 @@ + Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresScenarioRowTest.cs =================================================================== diff -u --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresScenarioRowTest.cs (revision 0) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresScenarioRowTest.cs (revision 8c76ed44224c5f2e96bd030b00c9bb8565e71330) @@ -0,0 +1,119 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base; +using Core.Common.Base.Geometry; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.ClosingStructures.Data; +using Ringtoets.ClosingStructures.Forms.Views; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms; + +namespace Ringtoets.ClosingStructures.Forms.Test.Views +{ + [TestFixture] + public class ClosingStructuresScenarioRowTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var section = new FailureMechanismSection("testName", new[] + { + new Point2D(1.1, 2.2), + new Point2D(3.3, 4.4) + }); + var sectionResult = new ClosingStructuresFailureMechanismSectionResult(section); + + // Call + var row = new ClosingStructuresScenarioRow(sectionResult); + + // Assert + Assert.AreSame(sectionResult.Section.Name, row.Name); + Assert.AreSame(sectionResult.Calculation, row.Calculation); + Assert.IsInstanceOf>(row); + } + + [Test] + public void Constructor_SectionResultIsNull_ThrowArgumentNullException() + { + // Call + TestDelegate call = () => new ClosingStructuresScenarioRow(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreSame("sectionResult", paramName); + } + + [Test] + public void Calculation_SetNewValue_UpdatesSectionResultCalculation() + { + // Setup + var section = new FailureMechanismSection("haha", new[] + { + new Point2D(1.1, 2.2), + new Point2D(3.3, 4.4) + }); + var sectionResult = new ClosingStructuresFailureMechanismSectionResult(section); + + var row = new ClosingStructuresScenarioRow(sectionResult); + + var calculation = new ClosingStructuresCalculation(); + + // Call + row.Calculation = calculation; + + // Assert + Assert.AreSame(calculation, row.Calculation); + Assert.AreSame(calculation, sectionResult.Calculation); + } + + [Test] + public void Calculation_SetNewValue_NotifyObserversOnSectionResult() + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + var section = new FailureMechanismSection("testSection", new[] + { + new Point2D(1.1, 2.2), + new Point2D(3.3, 4.4) + }); + var sectionResult = new ClosingStructuresFailureMechanismSectionResult(section); + sectionResult.Attach(observer); + + var row = new ClosingStructuresScenarioRow(sectionResult); + + var calculation = new ClosingStructuresCalculation(); + + // Call + row.Calculation = calculation; + + // Assert + mocks.VerifyAll(); // Assert observer is notified + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsScenarioRow.cs =================================================================== diff -u -rd39f2e1a0a36628bbd7751d426425d8f99b2b5af -r8c76ed44224c5f2e96bd030b00c9bb8565e71330 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsScenarioRow.cs (.../GrassCoverErosionInwardsScenarioRow.cs) (revision d39f2e1a0a36628bbd7751d426425d8f99b2b5af) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsScenarioRow.cs (.../GrassCoverErosionInwardsScenarioRow.cs) (revision 8c76ed44224c5f2e96bd030b00c9bb8565e71330) @@ -20,7 +20,6 @@ // All rights reserved. using System; -using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms; using Ringtoets.GrassCoverErosionInwards.Data; @@ -48,9 +47,6 @@ this.sectionResult = sectionResult; } - /// - /// Gets the name of the . - /// public string Name { get @@ -59,9 +55,6 @@ } } - /// - /// Gets or sets the normative calculation for the section. - /// public GrassCoverErosionInwardsCalculation Calculation { get