Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Ringtoets.DuneErosion.Forms.csproj =================================================================== diff -u -r1a1c79792a4f6e4ef9f79dce6017a0582f994559 -rdc532d6d17803dd8d323f7aa1f9fc95c691ae64e --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Ringtoets.DuneErosion.Forms.csproj (.../Ringtoets.DuneErosion.Forms.csproj) (revision 1a1c79792a4f6e4ef9f79dce6017a0582f994559) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Ringtoets.DuneErosion.Forms.csproj (.../Ringtoets.DuneErosion.Forms.csproj) (revision dc532d6d17803dd8d323f7aa1f9fc95c691ae64e) @@ -41,7 +41,7 @@ - + UserControl Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationCalculationRow.cs =================================================================== diff -u --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationCalculationRow.cs (revision 0) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationCalculationRow.cs (revision dc532d6d17803dd8d323f7aa1f9fc95c691ae64e) @@ -0,0 +1,149 @@ +// Copyright (C) Stichting Deltares 2017. 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 System.ComponentModel; +using System.Globalization; +using Core.Common.Base.Data; +using Core.Common.Base.Geometry; +using Ringtoets.Common.Forms.TypeConverters; +using Ringtoets.Common.Forms.Views; +using Ringtoets.DuneErosion.Data; +using DuneErosionDataResources = Ringtoets.DuneErosion.Data.Properties.Resources; + +namespace Ringtoets.DuneErosion.Forms.Views +{ + /// + /// This class represents a row of . + /// + public class DuneLocationCalculationRow : CalculatableRow + { + /// + /// Creates a new instance of . + /// + /// The to wrap. + /// Thrown when any input parameter is null. + public DuneLocationCalculationRow(DuneLocationCalculation duneLocationCalculation) + : base(duneLocationCalculation) {} + + /// + /// Gets the . + /// + public string Name + { + get + { + return CalculatableObject.DuneLocation.Name; + } + } + + /// + /// Gets the . + /// + public long Id + { + get + { + return CalculatableObject.DuneLocation.Id; + } + } + + /// + /// Gets the . + /// + public Point2D Location + { + get + { + return CalculatableObject.DuneLocation.Location; + } + } + + /// + /// Gets the . + /// + public int CoastalAreaId + { + get + { + return CalculatableObject.DuneLocation.CoastalAreaId; + } + } + + /// + /// Gets the . + /// + public string Offset + { + get + { + return CalculatableObject.DuneLocation.Offset.ToString(DuneErosionDataResources.DuneLocation_Offset_format, CultureInfo.InvariantCulture); + } + } + + /// + /// Gets the . + /// + [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + public RoundedDouble WaterLevel + { + get + { + return CalculatableObject.Output?.WaterLevel ?? RoundedDouble.NaN; + } + } + + /// + /// Gets the . + /// + [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + public RoundedDouble WaveHeight + { + get + { + return CalculatableObject.Output?.WaveHeight ?? RoundedDouble.NaN; + } + } + + /// + /// Gets the . + /// + [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + public RoundedDouble WavePeriod + { + get + { + return CalculatableObject.Output?.WavePeriod ?? RoundedDouble.NaN; + } + } + + /// + /// Gets the . + /// + public RoundedDouble D50 + { + get + { + return CalculatableObject.DuneLocation.D50; + } + } + } +} \ No newline at end of file Fisheye: Tag dc532d6d17803dd8d323f7aa1f9fc95c691ae64e refers to a dead (removed) revision in file `Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsView.cs =================================================================== diff -u -r8e9fe7a143bba19aacde920aedd2101683479e60 -rdc532d6d17803dd8d323f7aa1f9fc95c691ae64e --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsView.cs (.../DuneLocationsView.cs) (revision 8e9fe7a143bba19aacde920aedd2101683479e60) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsView.cs (.../DuneLocationsView.cs) (revision dc532d6d17803dd8d323f7aa1f9fc95c691ae64e) @@ -122,35 +122,35 @@ protected override void InitializeDataGridView() { base.InitializeDataGridView(); - dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationRow.Name), + dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationCalculationRow.Name), RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Name_DisplayName); - dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationRow.Id), + dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationCalculationRow.Id), RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Id_DisplayName); - dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationRow.Location), + dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationCalculationRow.Location), RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Coordinates_DisplayName); - dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationRow.CoastalAreaId), + dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationCalculationRow.CoastalAreaId), Resources.DuneLocation_CoastalAreaId_DisplayName); - dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationRow.Offset), + dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationCalculationRow.Offset), Resources.DuneLocation_Offset_DisplayName); - dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationRow.WaterLevel), + dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationCalculationRow.WaterLevel), Resources.DuneLocation_WaterLevel_DisplayName); - dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationRow.WaveHeight), + dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationCalculationRow.WaveHeight), Resources.DuneLocation_WaveHeight_DisplayName); - dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationRow.WavePeriod), + dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationCalculationRow.WavePeriod), Resources.DuneLocation_WavePeriod_DisplayName); - dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationRow.D50), + dataGridViewControl.AddTextBoxColumn(nameof(DuneLocationCalculationRow.D50), Resources.DuneLocation_D50_DisplayName); } protected override object CreateSelectedItemFromCurrentRow() { DataGridViewRow currentRow = dataGridViewControl.CurrentRow; - return ((DuneLocationRow) currentRow?.DataBoundItem)?.CalculatableObject; + return ((DuneLocationCalculationRow) currentRow?.DataBoundItem)?.CalculatableObject; } protected override void SetDataSource() { - dataGridViewControl.SetDataSource(calculations?.Select(calc => new DuneLocationRow(calc)).ToArray()); + dataGridViewControl.SetDataSource(calculations?.Select(calc => new DuneLocationCalculationRow(calc)).ToArray()); } protected override void CalculateForSelectedRows() Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsViewBase.cs =================================================================== diff -u -r639802f8d673561d9dc41f09e28564634076367d -rdc532d6d17803dd8d323f7aa1f9fc95c691ae64e --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsViewBase.cs (.../DuneLocationsViewBase.cs) (revision 639802f8d673561d9dc41f09e28564634076367d) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsViewBase.cs (.../DuneLocationsViewBase.cs) (revision dc532d6d17803dd8d323f7aa1f9fc95c691ae64e) @@ -91,7 +91,7 @@ /// protected virtual void InitializeDataGridView() { - dataGridViewControl.AddCheckBoxColumn(nameof(DuneLocationRow.ShouldCalculate), + dataGridViewControl.AddCheckBoxColumn(nameof(DuneLocationCalculationRow.ShouldCalculate), Resources.CalculatableView_Calculate); } @@ -115,11 +115,11 @@ /// /// Gets all the row items from the . /// - protected IEnumerable GetCalculatableRows() + protected IEnumerable GetCalculatableRows() { return dataGridViewControl.Rows .Cast() - .Select(row => (DuneLocationRow) row.DataBoundItem); + .Select(row => (DuneLocationCalculationRow) row.DataBoundItem); } /// Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Ringtoets.DuneErosion.Forms.Test.csproj =================================================================== diff -u -r1a1c79792a4f6e4ef9f79dce6017a0582f994559 -rdc532d6d17803dd8d323f7aa1f9fc95c691ae64e --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Ringtoets.DuneErosion.Forms.Test.csproj (.../Ringtoets.DuneErosion.Forms.Test.csproj) (revision 1a1c79792a4f6e4ef9f79dce6017a0582f994559) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Ringtoets.DuneErosion.Forms.Test.csproj (.../Ringtoets.DuneErosion.Forms.Test.csproj) (revision dc532d6d17803dd8d323f7aa1f9fc95c691ae64e) @@ -36,7 +36,7 @@ - + Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationCalculationRowTest.cs =================================================================== diff -u --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationCalculationRowTest.cs (revision 0) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationCalculationRowTest.cs (revision dc532d6d17803dd8d323f7aa1f9fc95c691ae64e) @@ -0,0 +1,100 @@ +// Copyright (C) Stichting Deltares 2017. 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 System.Globalization; +using Core.Common.Base.Geometry; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Forms.TypeConverters; +using Ringtoets.Common.Forms.Views; +using Ringtoets.DuneErosion.Data; +using Ringtoets.DuneErosion.Data.TestUtil; +using Ringtoets.DuneErosion.Forms.Views; + +namespace Ringtoets.DuneErosion.Forms.Test.Views +{ + [TestFixture] + public class DuneLocationCalculationRowTest + { + [Test] + [TestCase(34.1)] + [TestCase(34.0)] + public void Constructor_WithOutput_ExpectedValues(double offSet) + { + // Setup + var duneLocation = new DuneLocation(1, "test location", new Point2D(3.3, 4.4), new DuneLocation.ConstructionProperties + { + CoastalAreaId = 2, + Offset = offSet, + D50 = 0.000183 + }); + var duneLocationCalculation = new DuneLocationCalculation(duneLocation) + { + Output = new DuneLocationOutput(CalculationConvergence.CalculatedConverged, new DuneLocationOutput.ConstructionProperties + { + WaterLevel = 3.0, + WaveHeight = 4.0, + WavePeriod = 5.0 + }) + }; + + // Call + var row = new DuneLocationCalculationRow(duneLocationCalculation); + + // Assert + Assert.IsInstanceOf>(row); + Assert.AreSame(duneLocationCalculation, row.CalculatableObject); + Assert.AreEqual(duneLocation.Id, row.Id); + Assert.AreEqual(duneLocation.Name, row.Name); + Assert.AreSame(duneLocation.Location, row.Location); + Assert.AreEqual(duneLocation.CoastalAreaId, row.CoastalAreaId); + Assert.AreEqual(duneLocation.Offset.ToString("0.#", CultureInfo.InvariantCulture), row.Offset); + Assert.AreEqual(duneLocation.D50, row.D50); + Assert.AreEqual(duneLocationCalculation.Output.WaterLevel, row.WaterLevel); + Assert.AreEqual(duneLocationCalculation.Output.WaveHeight, row.WaveHeight); + Assert.AreEqual(duneLocationCalculation.Output.WavePeriod, row.WavePeriod); + + TestHelper.AssertTypeConverter( + nameof(DuneLocationCalculationRow.WaterLevel)); + TestHelper.AssertTypeConverter( + nameof(DuneLocationCalculationRow.WaveHeight)); + TestHelper.AssertTypeConverter( + nameof(DuneLocationCalculationRow.WavePeriod)); + } + + [Test] + public void Constructor_WithoutOutput_ExpectedValues() + { + // Setup + var duneLocationCalculation = new DuneLocationCalculation(new TestDuneLocation()); + + // Call + var row = new DuneLocationCalculationRow(duneLocationCalculation); + + // Assert + Assert.IsNaN(row.WaterLevel); + Assert.IsNaN(row.WaveHeight); + Assert.IsNaN(row.WavePeriod); + } + } +} \ No newline at end of file Fisheye: Tag dc532d6d17803dd8d323f7aa1f9fc95c691ae64e refers to a dead (removed) revision in file `Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationRowTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationsViewBaseTest.cs =================================================================== diff -u -r639802f8d673561d9dc41f09e28564634076367d -rdc532d6d17803dd8d323f7aa1f9fc95c691ae64e --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationsViewBaseTest.cs (.../DuneLocationsViewBaseTest.cs) (revision 639802f8d673561d9dc41f09e28564634076367d) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationsViewBaseTest.cs (.../DuneLocationsViewBaseTest.cs) (revision dc532d6d17803dd8d323f7aa1f9fc95c691ae64e) @@ -252,7 +252,7 @@ return view; } - private class TestCalculatableRow : DuneLocationRow + private class TestCalculatableRow : DuneLocationCalculationRow { public TestCalculatableRow(TestCalculatableObject calculatableObject) : base(calculatableObject) { Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationsViewTest.cs =================================================================== diff -u -r48689b27509dfee0fa27cbeee4a8f9c7d4043a34 -rdc532d6d17803dd8d323f7aa1f9fc95c691ae64e --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationsViewTest.cs (.../DuneLocationsViewTest.cs) (revision 48689b27509dfee0fa27cbeee4a8f9c7d4043a34) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationsViewTest.cs (.../DuneLocationsViewTest.cs) (revision dc532d6d17803dd8d323f7aa1f9fc95c691ae64e) @@ -271,7 +271,7 @@ // Assert var selection = view.Selection as DuneLocationCalculation; - var dataBoundItem = selectedLocationRow.DataBoundItem as DuneLocationRow; + var dataBoundItem = selectedLocationRow.DataBoundItem as DuneLocationCalculationRow; Assert.NotNull(selection); Assert.NotNull(dataBoundItem);