Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa -r8ed27cd893d87ef66f1bc4f6936407dcff4a284c --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -107,6 +107,24 @@ } /// + /// Looks up a localized string similar to Naam van de berekening.. + /// + public static string Calculation_Name_Description { + get { + return ResourceManager.GetString("Calculation_Name_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Naam. + /// + public static string Calculation_Name_DisplayName { + get { + return ResourceManager.GetString("Calculation_Name_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Naam van de berekeningsmap.. /// public static string CalculationGroup_Name_Description { Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx =================================================================== diff -u -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa -r8ed27cd893d87ef66f1bc4f6936407dcff4a284c --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -233,4 +233,10 @@ Naam + + Naam van de berekening. + + + Naam + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/CalculationContextProperties.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/CalculationContextProperties.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/CalculationContextProperties.cs (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -0,0 +1,50 @@ +// 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 Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.Properties; + +namespace Ringtoets.Integration.Forms.PropertyClasses +{ + [ResourcesDisplayName(typeof(Resources), "CalculationContextProperties_DisplayName")] + public class CalculationContextProperties : ObjectProperties> + { + [ResourcesCategory(typeof(Common.Data.Properties.Resources), "Categories_General")] + [ResourcesDisplayName(typeof(Resources), "Calculation_Name_DisplayName")] + [ResourcesDescription(typeof(Resources), "Calculation_Name_Description")] + public string Name + { + get + { + return data.WrappedData.Name; + } + set + { + data.WrappedData.Name = value; + data.NotifyObservers(); + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa -r8ed27cd893d87ef66f1bc4f6936407dcff4a284c --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -48,6 +48,7 @@ + Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs =================================================================== diff -u -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa -r8ed27cd893d87ef66f1bc4f6936407dcff4a284c --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -53,8 +53,6 @@ using Ringtoets.HydraRing.Calculation.Data.Output; using Ringtoets.HydraRing.Data; using Ringtoets.HydraRing.IO; -using Ringtoets.Integration.Data; -using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.PropertyClasses; using Ringtoets.Integration.Forms.Views; @@ -109,6 +107,7 @@ yield return new PropertyInfo(); yield return new PropertyInfo, StandAloneFailureMechanismContextProperties>(); yield return new PropertyInfo, CalculationGroupContextProperties>(); + yield return new PropertyInfo, CalculationContextProperties>(); } /// Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/CalculationContextPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/CalculationContextPropertiesTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/CalculationContextPropertiesTest.cs (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -0,0 +1,170 @@ +// 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 Core.Common.Base; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.PropertyClasses; + +namespace Ringtoets.Integration.Forms.Test.PropertyClasses +{ + [TestFixture] + public class CalculationContextPropertiesTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // Call + var properties = new CalculationContextProperties(); + + // Assert + Assert.IsInstanceOf>>(properties); + Assert.IsNull(properties.Data); + } + + [Test] + public void GetProperties_WithData_ReturnExpectedValues() + { + // Setup + const string name = ""; + var calculation = new TestCalculation() + { + Name = name + }; + + var mocks = new MockRepository(); + var failureMechanismMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var properties = new CalculationContextProperties + { + Data = new TestCalculationContext(calculation, failureMechanismMock) + }; + + // Call & Assert + Assert.AreEqual(name, properties.Name); + } + + [Test] + public void SetProperties_WithData_UpdateDataAndNotifyObservers() + { + // Setup + var mocks = new MockRepository(); + var projectObserver = mocks.StrictMock(); + projectObserver.Expect(o => o.UpdateObserver()); + var failureMechanismMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var calculation = new TestCalculation(); + var testCalculationContext = new TestCalculationContext(calculation, failureMechanismMock); + + testCalculationContext.Attach(projectObserver); + + var properties = new CalculationContextProperties + { + Data = testCalculationContext + }; + + // Call & Assert + const string newName = "haha"; + properties.Name = newName; + Assert.AreEqual(newName, calculation.Name); + mocks.VerifyAll(); + } + + [Test] + public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers() + { + // Setup + var mocks = new MockRepository(); + var projectObserver = mocks.StrictMock(); + int numberProperties = 1; + projectObserver.Expect(o => o.UpdateObserver()).Repeat.Times(numberProperties); + var failureMechanismMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var calculation = new TestCalculation(); + var testCalculationContext = new TestCalculationContext(calculation, failureMechanismMock); + + testCalculationContext.Attach(projectObserver); + + var properties = new CalculationContextProperties + { + Data = testCalculationContext + }; + + // Call + const string newName = "Some new cool pretty name"; + properties.Name = newName; + + // Assert + Assert.AreEqual(newName, calculation.Name); + + mocks.VerifyAll(); + } + + private class TestCalculationContext : Observable, ICalculationContext + { + public TestCalculationContext(ICalculation wrappedData, IFailureMechanism failureMechanism) + { + WrappedData = wrappedData; + FailureMechanism = failureMechanism; + } + + public ICalculation WrappedData { get; private set; } + + public IFailureMechanism FailureMechanism { get; private set; } + } + + private class TestCalculation : Observable, ICalculation + { + public string Name { get; set; } + + public string Comments { get; set; } + + public bool HasOutput + { + get + { + return false; + } + } + + public void ClearOutput() {} + + public void ClearHydraulicBoundaryLocation() {} + + public ICalculationInput GetObservableInput() + { + return null; + } + + public ICalculationOutput GetObservableOutput() + { + return null; + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa -r8ed27cd893d87ef66f1bc4f6936407dcff4a284c --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -63,6 +63,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs =================================================================== diff -u -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa -r8ed27cd893d87ef66f1bc4f6936407dcff4a284c --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -181,7 +181,7 @@ PropertyInfo[] propertyInfos = guiPlugin.GetPropertyInfos().ToArray(); // Assert - Assert.AreEqual(4, propertyInfos.Length); + Assert.AreEqual(5, propertyInfos.Length); var assessmentSectionProperties = propertyInfos.Single(pi => pi.DataType == typeof(IAssessmentSection)); Assert.AreEqual(typeof(AssessmentSectionProperties), assessmentSectionProperties.PropertyObjectType); @@ -206,6 +206,12 @@ Assert.IsNull(calculationGroupProperties.AdditionalDataCheck); Assert.IsNull(calculationGroupProperties.GetObjectPropertiesData); Assert.IsNull(calculationGroupProperties.AfterCreate); + + var calculationContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(ICalculationContext)); + Assert.AreEqual(typeof(CalculationContextProperties), calculationContextProperties.PropertyObjectType); + Assert.IsNull(calculationContextProperties.AdditionalDataCheck); + Assert.IsNull(calculationContextProperties.GetObjectPropertiesData); + Assert.IsNull(calculationContextProperties.AfterCreate); } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa -r8ed27cd893d87ef66f1bc4f6936407dcff4a284c --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -513,15 +513,6 @@ } /// - /// Looks up a localized string similar to Naam van de piping berekening.. - /// - public static string PipingCalculation_Name_Description { - get { - return ResourceManager.GetString("PipingCalculation_Name_Description", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Naam. /// public static string PipingCalculation_Name_DisplayName { Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx =================================================================== diff -u -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa -r8ed27cd893d87ef66f1bc4f6936407dcff4a284c --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -310,9 +310,6 @@ Profielschematisatie - - Naam van de piping berekening. - Naam Fisheye: Tag 8ed27cd893d87ef66f1bc4f6936407dcff4a284c refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingCalculationContextProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj =================================================================== diff -u -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa -r8ed27cd893d87ef66f1bc4f6936407dcff4a284c --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -76,7 +76,6 @@ Resources.resx - Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs =================================================================== diff -u -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa -r8ed27cd893d87ef66f1bc4f6936407dcff4a284c --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -67,7 +67,6 @@ public override IEnumerable GetPropertyInfos() { yield return new PropertyInfo(); - yield return new PropertyInfo(); yield return new PropertyInfo(); yield return new PropertyInfo(); yield return new PropertyInfo(); Fisheye: Tag 8ed27cd893d87ef66f1bc4f6936407dcff4a284c refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingCalculationContextPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj =================================================================== diff -u -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa -r8ed27cd893d87ef66f1bc4f6936407dcff4a284c --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -86,7 +86,6 @@ - Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs =================================================================== diff -u -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa -r8ed27cd893d87ef66f1bc4f6936407dcff4a284c --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision 8ed27cd893d87ef66f1bc4f6936407dcff4a284c) @@ -69,20 +69,14 @@ PropertyInfo[] propertyInfos = guiPlugin.GetPropertyInfos().ToArray(); // assert - Assert.AreEqual(7, propertyInfos.Length); + Assert.AreEqual(6, propertyInfos.Length); var pipingFailureMechanismContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(PipingFailureMechanismContext)); Assert.AreEqual(typeof(PipingFailureMechanismContextProperties), pipingFailureMechanismContextProperties.PropertyObjectType); Assert.IsNull(pipingFailureMechanismContextProperties.AdditionalDataCheck); Assert.IsNull(pipingFailureMechanismContextProperties.GetObjectPropertiesData); Assert.IsNull(pipingFailureMechanismContextProperties.AfterCreate); - var pipingCalculationContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(PipingCalculationScenarioContext)); - Assert.AreEqual(typeof(PipingCalculationContextProperties), pipingCalculationContextProperties.PropertyObjectType); - Assert.IsNull(pipingCalculationContextProperties.AdditionalDataCheck); - Assert.IsNull(pipingCalculationContextProperties.GetObjectPropertiesData); - Assert.IsNull(pipingCalculationContextProperties.AfterCreate); - var pipingInputContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(PipingInputContext)); Assert.AreEqual(typeof(PipingInputContextProperties), pipingInputContextProperties.PropertyObjectType); Assert.IsNull(pipingInputContextProperties.AdditionalDataCheck);