Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationDesignWaterLevelPropertiesTest.cs =================================================================== diff -u -r48421e138d2217a83dfb53956c74abe593e8df1a -rec29001a9e148ed508108e4fd64c2bc751a6c026 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationDesignWaterLevelPropertiesTest.cs (.../HydraulicBoundaryLocationDesignWaterLevelPropertiesTest.cs) (revision 48421e138d2217a83dfb53956c74abe593e8df1a) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationDesignWaterLevelPropertiesTest.cs (.../HydraulicBoundaryLocationDesignWaterLevelPropertiesTest.cs) (revision ec29001a9e148ed508108e4fd64c2bc751a6c026) @@ -26,7 +26,6 @@ using Core.Common.Gui.Attributes; using Core.Common.Gui.PropertyBag; using NUnit.Framework; -using Rhino.Mocks; using Ringtoets.HydraRing.Data; using Ringtoets.Integration.Forms.PropertyClasses; @@ -39,40 +38,64 @@ public void GetProperties_ValidData_ReturnsExpectedValues() { // Setup - long id = 1234L; - double x = 567.0; - double y = 890.0; + const long id = 1234; + const string name = ""; + const double x = 567.0; + const double y = 890.0; + HydraulicBoundaryLocation hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y); + + // Call + HydraulicBoundaryLocationDesignWaterLevelProperties properties = + new HydraulicBoundaryLocationDesignWaterLevelProperties(hydraulicBoundaryLocation); + + // Assert + Assert.AreEqual(id, properties.Id); + Assert.AreEqual(name, properties.Name); Point2D coordinates = new Point2D(x, y); - string name = ""; - double designWaterLevel = 5.123456; - string expectedDesignWaterLevel = designWaterLevel.ToString("F2", CultureInfo.InvariantCulture); + Assert.AreEqual(coordinates, properties.Location); + Assert.AreEqual(string.Empty, properties.DesignWaterLevel); + } - var mockRepository = new MockRepository(); - var hydraulicBoundaryLocationMock = mockRepository.StrictMock(id, name, x, y); - hydraulicBoundaryLocationMock.DesignWaterLevel = designWaterLevel; - mockRepository.ReplayAll(); + [Test] + public void GetProperties_ValidDesignWaterLevel_ReturnsExpectedValues() + { + // Setup + const long id = 1234L; + const double x = 567.0; + const double y = 890.0; + const string name = ""; + const double designWaterLevel = 5.123456; + HydraulicBoundaryLocation hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y) + { + DesignWaterLevel = designWaterLevel + }; + // Call - var properties = new HydraulicBoundaryLocationDesignWaterLevelProperties(hydraulicBoundaryLocationMock); + HydraulicBoundaryLocationDesignWaterLevelProperties properties = + new HydraulicBoundaryLocationDesignWaterLevelProperties(hydraulicBoundaryLocation); // Assert Assert.AreEqual(id, properties.Id); Assert.AreEqual(name, properties.Name); - Assert.AreEqual(expectedDesignWaterLevel, properties.DesignWaterLevel); + Point2D coordinates = new Point2D(x, y); Assert.AreEqual(coordinates, properties.Location); - mockRepository.VerifyAll(); + string expectedDesignWaterLevel = designWaterLevel.ToString("F2", CultureInfo.InvariantCulture); + Assert.AreEqual(expectedDesignWaterLevel, properties.DesignWaterLevel); } [Test] public void PropertyAttributes_ReturnExpectedValues() { // Setup - var mockRepository = new MockRepository(); - var hydraulicBoundaryLocationMock = mockRepository.StrictMock(0, "", 0.0, 0.0); - mockRepository.ReplayAll(); + HydraulicBoundaryLocation hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "", 0.0, 0.0); + HydraulicBoundaryLocationDesignWaterLevelProperties properties = + new HydraulicBoundaryLocationDesignWaterLevelProperties(hydraulicBoundaryLocation); - var properties = new HydraulicBoundaryLocationDesignWaterLevelProperties(hydraulicBoundaryLocationMock); + // Call + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + // Assert var dynamicPropertyBag = new DynamicPropertyBag(properties); const string expectedIdDisplayName = "ID"; const string expectedNameDisplayName = "Naam"; @@ -83,16 +106,12 @@ const string expectedLocationDescription = "Coördinaten van de hydraulische randvoorwaardenlocatie."; const string expectedDesignWaterLevelDescription = "Berekend toetspeil."; - // Call - TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); - - // Assert PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); PropertyDescriptor idProperty = dynamicProperties.Find("Id", false); PropertyDescriptor nameProperty = dynamicProperties.Find("Name", false); PropertyDescriptor locationProperty = dynamicProperties.Find("Location", false); PropertyDescriptor designWaterLevelProperty = dynamicProperties.Find("DesignWaterLevel", false); - + Assert.IsInstanceOf(classTypeConverter); Assert.IsNotNull(idProperty); @@ -122,8 +141,6 @@ Assert.AreEqual(expectedDesignWaterLevelDisplayName, designWaterLevelProperty.DisplayName); Assert.AreEqual(expectedDesignWaterLevelDescription, designWaterLevelProperty.Description); Assert.AreEqual(4, designWaterLevelProperty.Attributes.OfType().First().Order); - - mockRepository.VerifyAll(); } } } \ No newline at end of file