Fisheye: Tag c53329fe1a36963d7e55abd8882b8eef43a685aa refers to a dead (removed) revision in file `Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PropertyClasses/ClosingStructureFailureMechanismProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PropertyClasses/ClosingStructuresFailureMechanismProperties.cs =================================================================== diff -u --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PropertyClasses/ClosingStructuresFailureMechanismProperties.cs (revision 0) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PropertyClasses/ClosingStructuresFailureMechanismProperties.cs (revision c53329fe1a36963d7e55abd8882b8eef43a685aa) @@ -0,0 +1,201 @@ +// Copyright (C) Stichting Deltares 2016. 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.ComponentModel; +using Core.Common.Base.Data; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.ClosingStructures.Data; +using Ringtoets.ClosingStructures.Forms.Properties; +using Ringtoets.Common.Forms.PropertyClasses; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.ClosingStructures.Forms.PropertyClasses +{ + /// + /// ViewModel of for properties panel. + /// + public class ClosingStructuresFailureMechanismProperties : ObjectProperties + { + private const int namePropertyIndex = 1; + private const int codePropertyIndex = 2; + private const int gravitationalAccelerationPropertyIndex = 3; + + private const int cPropertyIndex = 4; + private const int n2APropertyIndex = 5; + private const int lengthEffectPropertyIndex = 6; + + private const int modelFactorOvertoppingFlowPropertyIndex = 7; + private const int modelFactorStorageVolumePropertyIndex = 8; + private const int modelFactorSubCriticalFlowPropertyIndex = 9; + private const int modelFactorInflowVolumePropertyIndex = 10; + + #region Length effect parameters + + [PropertyOrder(cPropertyIndex)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_LengthEffect")] + [ResourcesDisplayName(typeof(Resources), "ClosingStructureFailureMechanismContextProperties_C_DisplayName")] + [ResourcesDescription(typeof(Resources), "ClosingStructureFailureMechanismContextProperties_C_Description")] + public RoundedDouble C + { + get + { + return data.GeneralInput.C; + } + } + + [PropertyOrder(n2APropertyIndex)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_LengthEffect")] + [ResourcesDisplayName(typeof(Resources), "ClosingStructureFailureMechanismContextProperties_N2A_DisplayName")] + [ResourcesDescription(typeof(Resources), "ClosingStructureFailureMechanismContextProperties_N2A_Description")] + public int N2A + { + get + { + return data.GeneralInput.N2A; + } + set + { + data.GeneralInput.N2A = value; + data.NotifyObservers(); + } + } + + [PropertyOrder(lengthEffectPropertyIndex)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_LengthEffect")] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), "FailureMechanism_N_DisplayName")] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), "FailureMechanism_N_Description")] + public RoundedDouble LengthEffect + { + get + { + return data.GeneralInput.N; + } + } + + #endregion + + #region General + + [PropertyOrder(namePropertyIndex)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), "FailureMechanism_Name_DisplayName")] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), "FailureMechanism_Name_Description")] + public string Name + { + get + { + return data.Name; + } + } + + [PropertyOrder(codePropertyIndex)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), "FailureMechanism_Code_DisplayName")] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), "FailureMechanism_Code_Description")] + public string Code + { + get + { + return data.Code; + } + } + + [PropertyOrder(gravitationalAccelerationPropertyIndex)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), "GravitationalAcceleration_DisplayName")] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), "GravitationalAcceleration_Description")] + public RoundedDouble GravitationalAcceleration + { + get + { + return data.GeneralInput.GravitationalAcceleration; + } + } + + #endregion + + #region Model settings + + [PropertyOrder(modelFactorOvertoppingFlowPropertyIndex)] + [TypeConverter(typeof(ExpandableObjectConverter))] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_ModelSettings")] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), "StructuresInputFailureMechanismContext_ModelFactorOvertoppingFlow_DisplayName")] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), "StructuresInputFailureMechanismContext_ModelFactorOvertoppingFlow_Description")] + public LogNormalDistributionProperties ModelFactorOvertoppingFlow + { + get + { + return new LogNormalDistributionProperties + { + Data = data.GeneralInput.ModelFactorOvertoppingFlow + }; + } + } + + [PropertyOrder(modelFactorStorageVolumePropertyIndex)] + [TypeConverter(typeof(ExpandableObjectConverter))] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_ModelSettings")] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), "StructuresInputFailureMechanismContext_ModelFactorStorageVolume_DisplayName")] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), "StructuresInputFailureMechanismContext_ModelFactorStorageVolume_Description")] + public LogNormalDistributionProperties ModelFactorStorageVolume + { + get + { + return new LogNormalDistributionProperties + { + Data = data.GeneralInput.ModelFactorStorageVolume + }; + } + } + + [PropertyOrder(modelFactorSubCriticalFlowPropertyIndex)] + [TypeConverter(typeof(ExpandableObjectConverter))] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_ModelSettings")] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), "StructuresInputFailureMechanismContext_ModelFactorSubCriticalFlow_DisplayName")] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), "StructuresInputFailureMechanismContext_ModelFactorSubCriticalFlow_Description")] + public VariationCoefficientNormalDistributionProperties ModelFactorSubCriticalFlow + { + get + { + return new VariationCoefficientNormalDistributionProperties + { + Data = data.GeneralInput.ModelFactorSubCriticalFlow + }; + } + } + + [PropertyOrder(modelFactorInflowVolumePropertyIndex)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_ModelSettings")] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), "StructuresInputFailureMechanismContext_ModelFactorInflowVolume_DisplayName")] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), "StructuresInputFailureMechanismContext_ModelFactorInflowVolume_Description")] + public RoundedDouble ModelFactorInflowVolume + { + get + { + return data.GeneralInput.ModelFactorInflowVolume; + } + } + + #endregion + } +} \ No newline at end of file Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Ringtoets.ClosingStructures.Forms.csproj =================================================================== diff -u -r4af9b44a7b9bea4035396ef522fe83c4cdd6f398 -rc53329fe1a36963d7e55abd8882b8eef43a685aa --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Ringtoets.ClosingStructures.Forms.csproj (.../Ringtoets.ClosingStructures.Forms.csproj) (revision 4af9b44a7b9bea4035396ef522fe83c4cdd6f398) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Ringtoets.ClosingStructures.Forms.csproj (.../Ringtoets.ClosingStructures.Forms.csproj) (revision c53329fe1a36963d7e55abd8882b8eef43a685aa) @@ -42,7 +42,7 @@ Properties\GlobalAssembly.cs - + Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Plugin/ClosingStructuresPlugin.cs =================================================================== diff -u -r9383ddebb862ad6d2e18939d544c3710745a7e3f -rc53329fe1a36963d7e55abd8882b8eef43a685aa --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision 9383ddebb862ad6d2e18939d544c3710745a7e3f) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision c53329fe1a36963d7e55abd8882b8eef43a685aa) @@ -58,9 +58,9 @@ { public override IEnumerable GetPropertyInfos() { - yield return new PropertyInfo + yield return new PropertyInfo { - CreateInstance = context => new ClosingStructureFailureMechanismProperties + CreateInstance = context => new ClosingStructuresFailureMechanismProperties { Data = context.WrappedData } Fisheye: Tag c53329fe1a36963d7e55abd8882b8eef43a685aa refers to a dead (removed) revision in file `Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructureFailureMechanismPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresFailureMechanismPropertiesTest.cs =================================================================== diff -u --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresFailureMechanismPropertiesTest.cs (revision 0) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresFailureMechanismPropertiesTest.cs (revision c53329fe1a36963d7e55abd8882b8eef43a685aa) @@ -0,0 +1,201 @@ +// Copyright (C) Stichting Deltares 2016. 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.ComponentModel; +using Core.Common.Base; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.ClosingStructures.Data; +using Ringtoets.ClosingStructures.Forms.PropertyClasses; + +namespace Ringtoets.ClosingStructures.Forms.Test.PropertyClasses +{ + [TestFixture] + public class ClosingStructuresFailureMechanismPropertiesTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var properties = new ClosingStructuresFailureMechanismProperties(); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.IsNull(properties.Data); + } + + [Test] + public void Data_SetNewFailureMechanismContext_ReturnCorrectPropertyValues() + { + // Setup + var failureMechanism = new ClosingStructuresFailureMechanism(); + + var properties = new ClosingStructuresFailureMechanismProperties(); + + // Call + properties.Data = failureMechanism; + + // Assert + Assert.AreEqual("Kunstwerken - Betrouwbaarheid sluiting kunstwerk", + properties.Name); + Assert.AreEqual("BSKW", + properties.Code); + + GeneralClosingStructuresInput generalInput = failureMechanism.GeneralInput; + Assert.AreEqual(generalInput.GravitationalAcceleration.Value, + properties.GravitationalAcceleration.Value); + + Assert.AreEqual(generalInput.C.Value, properties.C.Value); + Assert.AreEqual(generalInput.N2A, properties.N2A); + Assert.AreEqual(generalInput.N.Value, properties.LengthEffect.Value); + + Assert.AreEqual(generalInput.ModelFactorOvertoppingFlow.Mean, properties.ModelFactorOvertoppingFlow.Mean); + Assert.AreEqual(generalInput.ModelFactorOvertoppingFlow.StandardDeviation, properties.ModelFactorOvertoppingFlow.StandardDeviation); + Assert.AreEqual(generalInput.ModelFactorStorageVolume.Mean, properties.ModelFactorStorageVolume.Mean); + Assert.AreEqual(generalInput.ModelFactorStorageVolume.StandardDeviation, properties.ModelFactorStorageVolume.StandardDeviation); + Assert.AreEqual(generalInput.ModelFactorSubCriticalFlow.Mean, properties.ModelFactorSubCriticalFlow.Mean); + Assert.AreEqual(generalInput.ModelFactorSubCriticalFlow.CoefficientOfVariation, properties.ModelFactorSubCriticalFlow.CoefficientOfVariation); + Assert.AreEqual(generalInput.ModelFactorInflowVolume.Value, properties.ModelFactorInflowVolume.Value); + } + + [Test] + public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers() + { + // Setup + const int numberOfChangedProperties = 1; + var mockRepository = new MockRepository(); + var observerMock = mockRepository.StrictMock(); + observerMock.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties); + mockRepository.ReplayAll(); + + var failureMechanism = new ClosingStructuresFailureMechanism(); + failureMechanism.Attach(observerMock); + var properties = new ClosingStructuresFailureMechanismProperties + { + Data = failureMechanism + }; + + const int newN2A = 10; + + // Call + properties.N2A = newN2A; + + // Assert + Assert.AreEqual(newN2A, failureMechanism.GeneralInput.N2A); + mockRepository.VerifyAll(); + } + + [Test] + public void Constructor_Always_PropertiesHaveExpectedAttributesValues() + { + // Setup + var failureMechanism = new ClosingStructuresFailureMechanism(); + + // Call + var properties = new ClosingStructuresFailureMechanismProperties + { + Data = failureMechanism + }; + + // Assert + var generalCategory = "Algemeen"; + var lengthEffectCategory = "Lengte-effect parameters"; + var modelSettingsCategory = "Modelinstellingen"; + + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(10, dynamicProperties.Count); + + PropertyDescriptor nameProperty = dynamicProperties[0]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, + generalCategory, + "Naam", + "De naam van het toetsspoor.", + true); + + PropertyDescriptor codeProperty = dynamicProperties[1]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(codeProperty, + generalCategory, + "Label", + "Het label van het toetsspoor.", + true); + + PropertyDescriptor gravitationalAccelerationProperty = dynamicProperties[2]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(gravitationalAccelerationProperty, + generalCategory, + "Valversnelling [m/s²]", + "Valversnelling.", + true); + + PropertyDescriptor cProperty = dynamicProperties[3]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(cProperty, + lengthEffectCategory, + "C [-]", + "De parameter 'C' die gebruikt wordt om het lengte-effect te berekenen.", + true); + + PropertyDescriptor n2AProperty = dynamicProperties[4]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(n2AProperty, + lengthEffectCategory, + "2NA [-]", + "De parameter '2NA' die gebruikt wordt om het lengte-effect te berekenen."); + + PropertyDescriptor lengthEffectProperty = dynamicProperties[5]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(lengthEffectProperty, + lengthEffectCategory, + "N [-]", + "De parameter 'N' die gebruikt wordt om het lengte-effect mee te nemen in een semi-probabilistische beoordeling.", + true); + + PropertyDescriptor modelFactorOvertoppingFlowProperty = dynamicProperties[6]; + Assert.IsInstanceOf(modelFactorOvertoppingFlowProperty.Converter); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(modelFactorOvertoppingFlowProperty, + modelSettingsCategory, + "Modelfactor overslagdebiet [-]", + "Modelfactor voor het overslagdebiet.", + true); + + PropertyDescriptor modelFactorStorageVolumeProperty = dynamicProperties[7]; + Assert.IsInstanceOf(modelFactorStorageVolumeProperty.Converter); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(modelFactorStorageVolumeProperty, + modelSettingsCategory, + "Modelfactor kombergend vermogen [-]", + "Modelfactor kombergend vermogen.", + true); + + PropertyDescriptor modelFactorSubCriticalFlowProperty = dynamicProperties[8]; + Assert.IsInstanceOf(modelFactorSubCriticalFlowProperty.Converter); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(modelFactorSubCriticalFlowProperty, + modelSettingsCategory, + "Modelfactor voor onvolkomen stroming [-]", + "Modelfactor voor onvolkomen stroming.", + true); + + PropertyDescriptor modelFactorInflowVolumeProperty = dynamicProperties[9]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(modelFactorInflowVolumeProperty, + modelSettingsCategory, + "Modelfactor instromend volume [-]", + "Modelfactor instromend volume.", + true); + } + } +} \ No newline at end of file Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Ringtoets.ClosingStructures.Forms.Test.csproj =================================================================== diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rc53329fe1a36963d7e55abd8882b8eef43a685aa --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Ringtoets.ClosingStructures.Forms.Test.csproj (.../Ringtoets.ClosingStructures.Forms.Test.csproj) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Ringtoets.ClosingStructures.Forms.Test.csproj (.../Ringtoets.ClosingStructures.Forms.Test.csproj) (revision c53329fe1a36963d7e55abd8882b8eef43a685aa) @@ -69,7 +69,7 @@ - + Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/ClosingStructuresPluginTest.cs =================================================================== diff -u -r6e56258ed65fb071d7dac5a9df4e71196542a392 -rc53329fe1a36963d7e55abd8882b8eef43a685aa --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/ClosingStructuresPluginTest.cs (.../ClosingStructuresPluginTest.cs) (revision 6e56258ed65fb071d7dac5a9df4e71196542a392) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/ClosingStructuresPluginTest.cs (.../ClosingStructuresPluginTest.cs) (revision c53329fe1a36963d7e55abd8882b8eef43a685aa) @@ -63,7 +63,7 @@ PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, typeof(ClosingStructuresFailureMechanismContext), - typeof(ClosingStructureFailureMechanismProperties)); + typeof(ClosingStructuresFailureMechanismProperties)); PluginTestHelper.AssertPropertyInfoDefined( propertyInfos,