Index: Core/Common/src/Core.Common.Gui/Forms/PropertyGridView/PropertyResolver.cs =================================================================== diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -rdf55938ef2e77d8060681a3a35e2d5a7466eb1f4 --- Core/Common/src/Core.Common.Gui/Forms/PropertyGridView/PropertyResolver.cs (.../PropertyResolver.cs) (revision ac96d7c315129af851634ed5a4a6800b59ede718) +++ Core/Common/src/Core.Common.Gui/Forms/PropertyGridView/PropertyResolver.cs (.../PropertyResolver.cs) (revision df55938ef2e77d8060681a3a35e2d5a7466eb1f4) @@ -48,6 +48,7 @@ { throw new ArgumentNullException(nameof(propertyInfos), Resources.PropertyResolver_PropertyResolver_Cannot_create_PropertyResolver_without_list_of_PropertyInfo); } + this.propertyInfos = propertyInfos.ToArray(); } Index: Core/Common/src/Core.Common.Gui/PropertyBag/ObjectProperties.cs =================================================================== diff -u -r2bca78cdfd4e336f16bf2abfffb3f5ba4d46277d -rdf55938ef2e77d8060681a3a35e2d5a7466eb1f4 --- Core/Common/src/Core.Common.Gui/PropertyBag/ObjectProperties.cs (.../ObjectProperties.cs) (revision 2bca78cdfd4e336f16bf2abfffb3f5ba4d46277d) +++ Core/Common/src/Core.Common.Gui/PropertyBag/ObjectProperties.cs (.../ObjectProperties.cs) (revision df55938ef2e77d8060681a3a35e2d5a7466eb1f4) @@ -21,7 +21,6 @@ using System; using System.ComponentModel; -using Core.Common.Base; namespace Core.Common.Gui.PropertyBag { @@ -35,7 +34,6 @@ public event EventHandler RefreshRequired; - [Browsable(false)] public object Data { Index: Core/Common/test/Core.Common.Gui.Test/Forms/PropertyGridView/PropertyGridViewTest.cs =================================================================== diff -u -r1ab3d180b9a6ea55959a33564b11bea9a10db3c8 -rdf55938ef2e77d8060681a3a35e2d5a7466eb1f4 --- Core/Common/test/Core.Common.Gui.Test/Forms/PropertyGridView/PropertyGridViewTest.cs (.../PropertyGridViewTest.cs) (revision 1ab3d180b9a6ea55959a33564b11bea9a10db3c8) +++ Core/Common/test/Core.Common.Gui.Test/Forms/PropertyGridView/PropertyGridViewTest.cs (.../PropertyGridViewTest.cs) (revision df55938ef2e77d8060681a3a35e2d5a7466eb1f4) @@ -165,6 +165,7 @@ dataObjectProperties.Expect(d => ((IDisposable) d).Dispose()); dataObjectProperties.Stub(d => ((IObjectProperties) d).RefreshRequired += null).IgnoreArguments(); dataObjectProperties.Stub(d => ((IObjectProperties) d).RefreshRequired -= null).IgnoreArguments(); + dataObjectProperties.Stub(d => ((IObjectProperties) d).Data).Return(dataObject); var newDataObject = new object(); var propertyResolver = mockRepository.StrictMock(); @@ -194,6 +195,7 @@ dataObjectProperties.Expect(d => ((IDisposable) d).Dispose()); dataObjectProperties.Stub(d => ((IObjectProperties) d).RefreshRequired += null).IgnoreArguments(); dataObjectProperties.Stub(d => ((IObjectProperties) d).RefreshRequired -= null).IgnoreArguments(); + dataObjectProperties.Stub(d => ((IObjectProperties) d).Data).Return(dataObject); var propertyResolver = mockRepository.StrictMock(); propertyResolver.Expect(prs => prs.GetObjectProperties(dataObject)).Return(new DynamicPropertyBag(dataObjectProperties)); Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationsPropertiesTest.cs =================================================================== diff -u -r2bca78cdfd4e336f16bf2abfffb3f5ba4d46277d -rdf55938ef2e77d8060681a3a35e2d5a7466eb1f4 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationsPropertiesTest.cs (.../HydraulicBoundaryLocationsPropertiesTest.cs) (revision 2bca78cdfd4e336f16bf2abfffb3f5ba4d46277d) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationsPropertiesTest.cs (.../HydraulicBoundaryLocationsPropertiesTest.cs) (revision df55938ef2e77d8060681a3a35e2d5a7466eb1f4) @@ -50,12 +50,13 @@ var locations = new ObservableList(); // Call - var properties = new TestHydraulicBoundaryLocationsProperties(locations); - - // Assert - Assert.IsInstanceOf>>(properties); - Assert.IsInstanceOf(properties); - Assert.AreSame(locations, properties.Data); + using (var properties = new TestHydraulicBoundaryLocationsProperties(locations)) + { + // Assert + Assert.IsInstanceOf>>(properties); + Assert.IsInstanceOf(properties); + Assert.AreSame(locations, properties.Data); + } } [Test] @@ -68,16 +69,17 @@ location }; - var properties = new TestHydraulicBoundaryLocationsProperties(hydraulicBoundaryLocations); + using(var properties = new TestHydraulicBoundaryLocationsProperties(hydraulicBoundaryLocations)) + { + var refreshRequiredRaised = 0; + properties.RefreshRequired += (sender, args) => refreshRequiredRaised++; - var refreshRequiredRaised = 0; - properties.RefreshRequired += (sender, args) => refreshRequiredRaised++; + // When + location.NotifyObservers(); - // When - location.NotifyObservers(); - - // Then - Assert.AreEqual(1, refreshRequiredRaised); + // Then + Assert.AreEqual(1, refreshRequiredRaised); + } } [Test] @@ -90,18 +92,20 @@ location }; - var properties = new TestHydraulicBoundaryLocationsProperties(hydraulicBoundaryLocations); + using (var properties = new TestHydraulicBoundaryLocationsProperties(hydraulicBoundaryLocations)) + { - var refreshRequiredRaised = 0; - properties.RefreshRequired += (sender, args) => refreshRequiredRaised++; + var refreshRequiredRaised = 0; + properties.RefreshRequired += (sender, args) => refreshRequiredRaised++; - properties.Dispose(); + properties.Dispose(); - // When - location.NotifyObservers(); + // When + location.NotifyObservers(); - // Then - Assert.AreEqual(0, refreshRequiredRaised); + // Then + Assert.AreEqual(0, refreshRequiredRaised); + } } private class TestHydraulicBoundaryLocationsProperties : HydraulicBoundaryLocationsProperties Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneLocationsPropertiesTest.cs =================================================================== diff -u -r2bca78cdfd4e336f16bf2abfffb3f5ba4d46277d -rdf55938ef2e77d8060681a3a35e2d5a7466eb1f4 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneLocationsPropertiesTest.cs (.../DuneLocationsPropertiesTest.cs) (revision 2bca78cdfd4e336f16bf2abfffb3f5ba4d46277d) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneLocationsPropertiesTest.cs (.../DuneLocationsPropertiesTest.cs) (revision df55938ef2e77d8060681a3a35e2d5a7466eb1f4) @@ -70,14 +70,15 @@ }; // Call - var properties = new DuneLocationsProperties(locations, l => new DuneLocationCalculation()); + using (var properties = new DuneLocationsProperties(locations, l => new DuneLocationCalculation())) + { + // Assert + Assert.IsInstanceOf>>(properties); + Assert.IsInstanceOf(properties); - // Assert - Assert.IsInstanceOf>>(properties); - Assert.IsInstanceOf(properties); - - Assert.AreEqual(1, properties.Locations.Length); - Assert.AreSame(location, properties.Locations[0].Data); + Assert.AreEqual(1, properties.Locations.Length); + Assert.AreSame(location, properties.Locations[0].Data); + } } [Test] @@ -91,24 +92,25 @@ }; // Call - var properties = new DuneLocationsProperties(locations, l => new DuneLocationCalculation()); + using (var properties = new DuneLocationsProperties(locations, l => new DuneLocationCalculation())) + { + // Assert + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); - // Assert - TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); - Assert.IsInstanceOf(classTypeConverter); + Assert.AreSame(locations, properties.Data); - Assert.AreSame(locations, properties.Data); + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(1, dynamicProperties.Count); - PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); - Assert.AreEqual(1, dynamicProperties.Count); - - PropertyDescriptor locationsProperty = dynamicProperties[requiredLocationsPropertyIndex]; - Assert.IsInstanceOf(locationsProperty.Converter); - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(locationsProperty, - "Algemeen", - "Locaties", - "Locaties uit de hydraulische randvoorwaardendatabase.", - true); + PropertyDescriptor locationsProperty = dynamicProperties[requiredLocationsPropertyIndex]; + Assert.IsInstanceOf(locationsProperty.Converter); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(locationsProperty, + "Algemeen", + "Locaties", + "Locaties uit de hydraulische randvoorwaardendatabase.", + true); + } } [Test] @@ -121,16 +123,18 @@ location }; - var properties = new DuneLocationsProperties(duneLocations, l => new DuneLocationCalculation()); + using (var properties = new DuneLocationsProperties(duneLocations, l => new DuneLocationCalculation())) + { - var refreshRequiredRaised = 0; - properties.RefreshRequired += (sender, args) => refreshRequiredRaised++; + var refreshRequiredRaised = 0; + properties.RefreshRequired += (sender, args) => refreshRequiredRaised++; - // When - location.NotifyObservers(); + // When + location.NotifyObservers(); - // Then - Assert.AreEqual(1, refreshRequiredRaised); + // Then + Assert.AreEqual(1, refreshRequiredRaised); + } } [Test] @@ -143,18 +147,20 @@ location }; - var properties = new DuneLocationsProperties(duneLocations, l => new DuneLocationCalculation()); + using (var properties = new DuneLocationsProperties(duneLocations, l => new DuneLocationCalculation())) + { - var refreshRequiredRaised = 0; - properties.RefreshRequired += (sender, args) => refreshRequiredRaised++; + var refreshRequiredRaised = 0; + properties.RefreshRequired += (sender, args) => refreshRequiredRaised++; - properties.Dispose(); + properties.Dispose(); - // When - location.NotifyObservers(); + // When + location.NotifyObservers(); - // Then - Assert.AreEqual(0, refreshRequiredRaised); + // Then + Assert.AreEqual(0, refreshRequiredRaised); + } } } } \ No newline at end of file