Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextPropertiesTest.cs =================================================================== diff -u -rcfca0be21e050ae7ed7626ef4e3b1472eecc69a1 -r816744aa249d90e7460b9c2844292b2e0cf13669 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextPropertiesTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsContextPropertiesTest.cs) (revision cfca0be21e050ae7ed7626ef4e3b1472eecc69a1) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextPropertiesTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsContextPropertiesTest.cs) (revision 816744aa249d90e7460b9c2844292b2e0cf13669) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.ComponentModel; using Core.Common.Base; using Core.Common.Gui.Converters; @@ -35,50 +36,30 @@ public class GrassCoverErosionOutwardsDesignWaterLevelLocationsContextPropertiesTest { [Test] - public void DefaultConstructor_ExpectedValues() + public void Constructor_WithoutLocations_ExpectedValues() { // Call - var properties = new GrassCoverErosionOutwardsDesignWaterLevelLocationsContextProperties(); + TestDelegate test = () => new GrassCoverErosionOutwardsDesignWaterLevelLocationsContextProperties(null); // Assert - Assert.IsInstanceOf>>(properties); - Assert.IsNull(properties.Data); + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("locations", paramName); } [Test] - public void GetProperties_WithData_ReturnExpectedValues() + public void Constructor_WithLocations_ExpectedValues() { // Setup - HydraulicBoundaryLocation location = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(1.2); + var hydraulicBoundaryLocations = new ObservableList(); // Call - var properties = new GrassCoverErosionOutwardsDesignWaterLevelLocationsContextProperties - { - Data = new ObservableList - { - location - } - }; + var properties = new GrassCoverErosionOutwardsDesignWaterLevelLocationsContextProperties( + hydraulicBoundaryLocations); // Assert - Assert.AreEqual(1, properties.Locations.Length); - Assert.IsTrue(TypeUtils.HasTypeConverter(p => p.Locations)); - GrassCoverErosionOutwardsDesignWaterLevelLocationContextProperties locationProperties = properties.Locations[0]; - Assert.AreEqual(location.Name, locationProperties.Name); - Assert.AreEqual(location.Id, locationProperties.Id); - Assert.AreEqual(location.Location, locationProperties.Location); - Assert.AreEqual(location.DesignWaterLevel, locationProperties.DesignWaterLevel, location.DesignWaterLevel.GetAccuracy()); - Assert.AreEqual("Ja", locationProperties.Convergence); - } + Assert.IsInstanceOf>>(properties); + Assert.AreSame(hydraulicBoundaryLocations, properties.Data); - [Test] - public void Constructor_Always_PropertiesHaveExpectedAttributesValues() - { - // Call - var properties = new GrassCoverErosionOutwardsDesignWaterLevelLocationsContextProperties(); - - // Assert var dynamicPropertyBag = new DynamicPropertyBag(properties); const string expectedLocationsDisplayName = "Locaties"; const string expectedLocationsDescription = "Locaties uit de hydraulische randvoorwaardendatabase."; @@ -97,5 +78,30 @@ Assert.AreEqual(expectedLocationsDescription, locationsProperty.Description); Assert.AreEqual(expectedLocationsCategory, locationsProperty.Category); } + + [Test] + public void GetProperties_WithData_ReturnExpectedValues() + { + // Setup + HydraulicBoundaryLocation location = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(1.2); + + // Call + var properties = new GrassCoverErosionOutwardsDesignWaterLevelLocationsContextProperties( + new ObservableList + { + location + }); + + // Assert + Assert.AreEqual(1, properties.Locations.Length); + Assert.IsTrue(TypeUtils.HasTypeConverter(p => p.Locations)); + GrassCoverErosionOutwardsDesignWaterLevelLocationContextProperties locationProperties = properties.Locations[0]; + Assert.AreEqual(location.Name, locationProperties.Name); + Assert.AreEqual(location.Id, locationProperties.Id); + Assert.AreEqual(location.Location, locationProperties.Location); + Assert.AreEqual(location.DesignWaterLevel, locationProperties.DesignWaterLevel, location.DesignWaterLevel.GetAccuracy()); + Assert.AreEqual("Ja", locationProperties.Convergence); + } } } \ No newline at end of file