Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationDesignWaterLevelProperties.cs =================================================================== diff -u -r7cb21cb8c5e2a67bf24b9e2858ef861a15ee537e -r9663b036afafe1a23c75ade5af7318830c10d408 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationDesignWaterLevelProperties.cs (.../HydraulicBoundaryLocationDesignWaterLevelProperties.cs) (revision 7cb21cb8c5e2a67bf24b9e2858ef861a15ee537e) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationDesignWaterLevelProperties.cs (.../HydraulicBoundaryLocationDesignWaterLevelProperties.cs) (revision 9663b036afafe1a23c75ade5af7318830c10d408) @@ -64,6 +64,7 @@ /// Gets the . /// [PropertyOrder(4)] + [ResourcesCategory(typeof(Common.Data.Properties.Resources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "HydraulicBoundaryDatabase_Locations_DesignWaterLevel_DisplayName")] [ResourcesDescription(typeof(Resources), "HydraulicBoundaryDatabase_Locations_DesignWaterLevel_Description")] public string DesignWaterLevel Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs =================================================================== diff -u -r7cb21cb8c5e2a67bf24b9e2858ef861a15ee537e -r9663b036afafe1a23c75ade5af7318830c10d408 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision 7cb21cb8c5e2a67bf24b9e2858ef861a15ee537e) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision 9663b036afafe1a23c75ade5af7318830c10d408) @@ -39,6 +39,7 @@ /// Gets the . /// [PropertyOrder(1)] + [ResourcesCategory(typeof(Common.Data.Properties.Resources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "HydraulicBoundaryDatabase_Locations_Id_DisplayName")] [ResourcesDescription(typeof(Resources), "HydraulicBoundaryDatabase_Locations_Id_Description")] public virtual long Id @@ -53,6 +54,7 @@ /// Gets the . /// [PropertyOrder(2)] + [ResourcesCategory(typeof(Common.Data.Properties.Resources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "HydraulicBoundaryDatabase_Locations_Name_DisplayName")] [ResourcesDescription(typeof(Resources), "HydraulicBoundaryDatabase_Locations_Name_Description")] public virtual string Name @@ -67,6 +69,7 @@ /// Gets the . /// [PropertyOrder(3)] + [ResourcesCategory(typeof(Common.Data.Properties.Resources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "HydraulicBoundaryDatabase_Locations_Coordinates_DisplayName")] [ResourcesDescription(typeof(Resources), "HydraulicBoundaryDatabase_Locations_Coordinates_Description")] public virtual Point2D Location Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationWaveHeightProperties.cs =================================================================== diff -u -r7cb21cb8c5e2a67bf24b9e2858ef861a15ee537e -r9663b036afafe1a23c75ade5af7318830c10d408 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationWaveHeightProperties.cs (.../HydraulicBoundaryLocationWaveHeightProperties.cs) (revision 7cb21cb8c5e2a67bf24b9e2858ef861a15ee537e) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationWaveHeightProperties.cs (.../HydraulicBoundaryLocationWaveHeightProperties.cs) (revision 9663b036afafe1a23c75ade5af7318830c10d408) @@ -64,6 +64,7 @@ /// Gets the . /// [PropertyOrder(4)] + [ResourcesCategory(typeof(Common.Data.Properties.Resources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "HydraulicBoundaryDatabase_Locations_WaveHeight_DisplayName")] [ResourcesDescription(typeof(Resources), "HydraulicBoundaryDatabase_Locations_WaveHeight_Description")] public string WaveHeight Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationDesignWaterLevelPropertiesTest.cs =================================================================== diff -u -r7cb21cb8c5e2a67bf24b9e2858ef861a15ee537e -r9663b036afafe1a23c75ade5af7318830c10d408 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationDesignWaterLevelPropertiesTest.cs (.../HydraulicBoundaryLocationDesignWaterLevelPropertiesTest.cs) (revision 7cb21cb8c5e2a67bf24b9e2858ef861a15ee537e) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationDesignWaterLevelPropertiesTest.cs (.../HydraulicBoundaryLocationDesignWaterLevelPropertiesTest.cs) (revision 9663b036afafe1a23c75ade5af7318830c10d408) @@ -106,6 +106,7 @@ // Assert var dynamicPropertyBag = new DynamicPropertyBag(properties); + const string expectedCategory = "Algemeen"; const string expectedIdDisplayName = "ID"; const string expectedNameDisplayName = "Naam"; const string expectedLocationDisplayName = "Coördinaten [m]"; @@ -126,27 +127,31 @@ Assert.IsNotNull(idProperty); Assert.IsTrue(idProperty.IsReadOnly); Assert.IsTrue(idProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, idProperty.Category); Assert.AreEqual(expectedIdDisplayName, idProperty.DisplayName); Assert.AreEqual(expectedIdDescription, idProperty.Description); Assert.AreEqual(1, idProperty.Attributes.OfType().First().Order); Assert.IsNotNull(nameProperty); Assert.IsTrue(nameProperty.IsReadOnly); Assert.IsTrue(nameProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, nameProperty.Category); Assert.AreEqual(expectedNameDisplayName, nameProperty.DisplayName); Assert.AreEqual(expectedNameDescription, nameProperty.Description); Assert.AreEqual(2, nameProperty.Attributes.OfType().First().Order); Assert.IsNotNull(locationProperty); Assert.IsTrue(locationProperty.IsReadOnly); Assert.IsTrue(locationProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, locationProperty.Category); Assert.AreEqual(expectedLocationDisplayName, locationProperty.DisplayName); Assert.AreEqual(expectedLocationDescription, locationProperty.Description); Assert.AreEqual(3, locationProperty.Attributes.OfType().First().Order); Assert.IsNotNull(designWaterLevelProperty); Assert.IsTrue(designWaterLevelProperty.IsReadOnly); Assert.IsTrue(designWaterLevelProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, designWaterLevelProperty.Category); Assert.AreEqual(expectedDesignWaterLevelDisplayName, designWaterLevelProperty.DisplayName); Assert.AreEqual(expectedDesignWaterLevelDescription, designWaterLevelProperty.Description); Assert.AreEqual(4, designWaterLevelProperty.Attributes.OfType().First().Order); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs =================================================================== diff -u -r7cb21cb8c5e2a67bf24b9e2858ef861a15ee537e -r9663b036afafe1a23c75ade5af7318830c10d408 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision 7cb21cb8c5e2a67bf24b9e2858ef861a15ee537e) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision 9663b036afafe1a23c75ade5af7318830c10d408) @@ -133,6 +133,7 @@ }; var dynamicPropertyBag = new DynamicPropertyBag(hydraulicBoundaryLocationProperties); + const string expectedCategory = "Algemeen"; const string expectedIdDisplayName = "ID"; const string expectedNameDisplayName = "Naam"; const string expectedLocationDisplayName = "Coördinaten [m]"; @@ -154,20 +155,23 @@ Assert.IsNotNull(idProperty); Assert.IsTrue(idProperty.IsReadOnly); Assert.IsTrue(idProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, idProperty.Category); Assert.AreEqual(expectedIdDisplayName, idProperty.DisplayName); Assert.AreEqual(expectedIdDescription, idProperty.Description); Assert.AreEqual(1, idProperty.Attributes.OfType().First().Order); Assert.IsNotNull(nameProperty); Assert.IsTrue(nameProperty.IsReadOnly); Assert.IsTrue(nameProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, nameProperty.Category); Assert.AreEqual(expectedNameDisplayName, nameProperty.DisplayName); Assert.AreEqual(expectedNameDescription, nameProperty.Description); Assert.AreEqual(2, nameProperty.Attributes.OfType().First().Order); Assert.IsNotNull(locationProperty); Assert.IsTrue(locationProperty.IsReadOnly); Assert.IsTrue(locationProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, locationProperty.Category); Assert.AreEqual(expectedLocationDisplayName, locationProperty.DisplayName); Assert.AreEqual(expectedLocationDescription, locationProperty.Description); Assert.AreEqual(3, locationProperty.Attributes.OfType().First().Order); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationWaveHeightPropertiesTest.cs =================================================================== diff -u -r7cb21cb8c5e2a67bf24b9e2858ef861a15ee537e -r9663b036afafe1a23c75ade5af7318830c10d408 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationWaveHeightPropertiesTest.cs (.../HydraulicBoundaryLocationWaveHeightPropertiesTest.cs) (revision 7cb21cb8c5e2a67bf24b9e2858ef861a15ee537e) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationWaveHeightPropertiesTest.cs (.../HydraulicBoundaryLocationWaveHeightPropertiesTest.cs) (revision 9663b036afafe1a23c75ade5af7318830c10d408) @@ -104,6 +104,7 @@ // Assert var dynamicPropertyBag = new DynamicPropertyBag(properties); + const string expectedCategory = "Algemeen"; const string expectedIdDisplayName = "ID"; const string expectedNameDisplayName = "Naam"; const string expectedLocationDisplayName = "Coördinaten [m]"; @@ -123,27 +124,31 @@ Assert.IsNotNull(idProperty); Assert.IsTrue(idProperty.IsReadOnly); Assert.IsTrue(idProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, idProperty.Category); Assert.AreEqual(expectedIdDisplayName, idProperty.DisplayName); Assert.AreEqual(expectedIdDescription, idProperty.Description); Assert.AreEqual(1, idProperty.Attributes.OfType().First().Order); Assert.IsNotNull(nameProperty); Assert.IsTrue(nameProperty.IsReadOnly); Assert.IsTrue(nameProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, nameProperty.Category); Assert.AreEqual(expectedNameDisplayName, nameProperty.DisplayName); Assert.AreEqual(expectedNameDescription, nameProperty.Description); Assert.AreEqual(2, nameProperty.Attributes.OfType().First().Order); Assert.IsNotNull(locationProperty); Assert.IsTrue(locationProperty.IsReadOnly); Assert.IsTrue(locationProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, locationProperty.Category); Assert.AreEqual(expectedLocationDisplayName, locationProperty.DisplayName); Assert.AreEqual(expectedLocationDescription, locationProperty.Description); Assert.AreEqual(3, locationProperty.Attributes.OfType().First().Order); Assert.IsNotNull(waveHeightProperty); Assert.IsTrue(waveHeightProperty.IsReadOnly); Assert.IsTrue(waveHeightProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, waveHeightProperty.Category); Assert.AreEqual(expectedWaveHeightDisplayName, waveHeightProperty.DisplayName); Assert.AreEqual(expectedWaveHeightDescription, waveHeightProperty.Description); Assert.AreEqual(4, waveHeightProperty.Attributes.OfType().First().Order); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/HydraulicBoundaryLocationDesignWaterLevelsViewTest.cs =================================================================== diff -u -r7d12b4b34fc1d160cf0aeab237b1b41a4f037aac -r9663b036afafe1a23c75ade5af7318830c10d408 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/HydraulicBoundaryLocationDesignWaterLevelsViewTest.cs (.../HydraulicBoundaryLocationDesignWaterLevelsViewTest.cs) (revision 7d12b4b34fc1d160cf0aeab237b1b41a4f037aac) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/HydraulicBoundaryLocationDesignWaterLevelsViewTest.cs (.../HydraulicBoundaryLocationDesignWaterLevelsViewTest.cs) (revision 9663b036afafe1a23c75ade5af7318830c10d408) @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Windows.Forms; using Core.Common.Base; @@ -67,6 +68,7 @@ Assert.IsInstanceOf(view); Assert.IsNull(view.Data); Assert.IsNull(view.AssessmentSection); + Assert.IsNull(view.ApplicationSelection); } } @@ -98,6 +100,38 @@ } [Test] + public void Data_HydraulicBoundaryDatabase_DataSet() + { + // Setup + using (var view = new HydraulicBoundaryLocationDesignWaterLevelsView()) + { + var hydraulicBoundaryDatabase = new TestHydraulicBoundaryDatabase(); + + // Call + view.Data = hydraulicBoundaryDatabase; + + // Assert + Assert.AreSame(hydraulicBoundaryDatabase, view.Data); + } + } + + [Test] + public void Data_OtherThanHydraulicBoundaryDatabase_DataNull() + { + // Setup + using (var view = new HydraulicBoundaryLocationDesignWaterLevelsView()) + { + var data = new object(); + + // Call + view.Data = data; + + // Assert + Assert.IsNull(view.Data); + } + } + + [Test] public void HydraulicBoundaryLocationDesignWaterLevelsView_AssessmentSectionWithData_DataGridViewCorrectlyInitialized() { // Setup & Call @@ -120,7 +154,7 @@ Assert.AreEqual("2", cells[locationNameColumnIndex].FormattedValue); Assert.AreEqual("2", cells[locationIdColumnIndex].FormattedValue); Assert.AreEqual(new Point2D(2, 2).ToString(), cells[locationColumnIndex].FormattedValue); - Assert.AreEqual("1.23", cells[locationDesignWaterlevelColumnIndex].FormattedValue); + Assert.AreEqual(1.23.ToString(CultureInfo.CurrentCulture), cells[locationDesignWaterlevelColumnIndex].FormattedValue); cells = rows[2].Cells; Assert.AreEqual(4, cells.Count); @@ -131,6 +165,61 @@ } [Test] + public void HydraulicBoundaryLocationDesignWaterLevelsView_HydraulicBoundaryDatabaseUpdated_DataGridViewCorrectlyUpdated() + { + // Setup + HydraulicBoundaryLocationDesignWaterLevelsView view = ShowFullyConfiguredHydraulicBoundaryLocationDesignWaterLevelsView(); + HydraulicBoundaryDatabase newHydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + newHydraulicBoundaryDatabase.Locations.Add(new HydraulicBoundaryLocation(10, "10", 10.0, 10.0) + { + DesignWaterLevel = 10.23 + }); + + // Precondition + var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; + var rows = dataGridView.Rows; + Assert.AreEqual(3, rows.Count); + + // Call + view.Data = newHydraulicBoundaryDatabase; + + // Assert + Assert.AreEqual(1, rows.Count); + var cells = rows[0].Cells; + Assert.AreEqual(4, cells.Count); + Assert.AreEqual("10", cells[locationNameColumnIndex].FormattedValue); + Assert.AreEqual("10", cells[locationIdColumnIndex].FormattedValue); + Assert.AreEqual(new Point2D(10, 10).ToString(), cells[locationColumnIndex].FormattedValue); + Assert.AreEqual(10.23.ToString(CultureInfo.CurrentCulture), cells[locationDesignWaterlevelColumnIndex].FormattedValue); + } + + [Test] + public void HydraulicBoundaryLocationDesignWaterLevelsView_AssessmentSectionUpdated_DataGridViewCorrectlyUpdated() + { + // Setup + HydraulicBoundaryLocationDesignWaterLevelsView view = ShowFullyConfiguredHydraulicBoundaryLocationDesignWaterLevelsView(); + IAssessmentSection section = view.AssessmentSection; + + // Precondition + var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; + var rows = dataGridView.Rows; + Assert.AreEqual(3, rows.Count); + Assert.AreEqual("NaN", rows[0].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); + Assert.AreEqual(1.23.ToString(CultureInfo.CurrentCulture), rows[1].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); + Assert.AreEqual("NaN", rows[2].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); + + // Call + section.HydraulicBoundaryDatabase.Locations.ForEach(loc => loc.DesignWaterLevel = double.NaN); + section.NotifyObservers(); + + // Assert + Assert.AreEqual(3, rows.Count); + Assert.AreEqual("NaN", rows[0].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); + Assert.AreEqual("NaN", rows[1].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); + Assert.AreEqual("NaN", rows[2].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); + } + + [Test] public void HydraulicBoundaryLocationDesignWaterLevelsView_SelectingCellInRow_ApplicationSelectionCorrectlySynced() { // Setup @@ -200,38 +289,6 @@ Assert.AreSame(dataRow.HydraulicBoundaryLocation, ((DesignWaterLevelLocationContext) selection).WrappedData); } - [Test] - public void Data_HydraulicBoundaryDatabase_DataSet() - { - // Setup - using (var view = new HydraulicBoundaryLocationDesignWaterLevelsView()) - { - var hydraulicBoundaryDatabase = new TestHydraulicBoundaryDatabase(); - - // Call - view.Data = hydraulicBoundaryDatabase; - - // Assert - Assert.AreSame(hydraulicBoundaryDatabase, view.Data); - } - } - - [Test] - public void Data_OtherThanHydraulicBoundaryDatabase_DataNull() - { - // Setup - using (var view = new HydraulicBoundaryLocationDesignWaterLevelsView()) - { - var data = new object(); - - // Call - view.Data = data; - - // Assert - Assert.IsNull(view.Data); - } - } - private const int locationNameColumnIndex = 0; private const int locationIdColumnIndex = 1; private const int locationColumnIndex = 2; @@ -260,43 +317,43 @@ view.AssessmentSection = assessmentSection; return view; } - } - public class TestHydraulicBoundaryDatabase : HydraulicBoundaryDatabase - { - public TestHydraulicBoundaryDatabase() + private class TestHydraulicBoundaryDatabase : HydraulicBoundaryDatabase { - Locations.Add(new HydraulicBoundaryLocation(1, "1", 1.0, 1.0)); - Locations.Add(new HydraulicBoundaryLocation(2, "2", 2.0, 2.0) + public TestHydraulicBoundaryDatabase() { - DesignWaterLevel = 1.23 - }); - Locations.Add(new HydraulicBoundaryLocation(3, "3", 3.0, 3.0) - { - WaveHeight = 2.45 - }); + Locations.Add(new HydraulicBoundaryLocation(1, "1", 1.0, 1.0)); + Locations.Add(new HydraulicBoundaryLocation(2, "2", 2.0, 2.0) + { + DesignWaterLevel = 1.23 + }); + Locations.Add(new HydraulicBoundaryLocation(3, "3", 3.0, 3.0) + { + WaveHeight = 2.45 + }); + } } - } - public class TestAssessmentSection : Observable, IAssessmentSection - { - public string Comments { get; set; } - public long StorageId { get; set; } - public string Id { get; set; } - public string Name { get; set; } - public AssessmentSectionComposition Composition { get; private set; } - public ReferenceLine ReferenceLine { get; set; } - public FailureMechanismContribution FailureMechanismContribution { get; private set; } - public HydraulicBoundaryDatabase HydraulicBoundaryDatabase { get; set; } - - public IEnumerable GetFailureMechanisms() + private class TestAssessmentSection : Observable, IAssessmentSection { - throw new NotImplementedException(); - } + public string Comments { get; set; } + public long StorageId { get; set; } + public string Id { get; set; } + public string Name { get; set; } + public AssessmentSectionComposition Composition { get; private set; } + public ReferenceLine ReferenceLine { get; set; } + public FailureMechanismContribution FailureMechanismContribution { get; private set; } + public HydraulicBoundaryDatabase HydraulicBoundaryDatabase { get; set; } - public void ChangeComposition(AssessmentSectionComposition newComposition) - { - throw new NotImplementedException(); + public IEnumerable GetFailureMechanisms() + { + throw new NotImplementedException(); + } + + public void ChangeComposition(AssessmentSectionComposition newComposition) + { + throw new NotImplementedException(); + } } } } \ No newline at end of file