Fisheye: Tag 75aa4fefacf584d5172dc3bdffd348b0aacb05a4 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Gui/ColorTheme.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj =================================================================== diff -u -r8376f3f25a98f8755479ed069c318e0b70922b38 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 8376f3f25a98f8755479ed069c318e0b70922b38) +++ Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -115,7 +115,8 @@ - + + Index: Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs =================================================================== diff -u -r3ede22c08da5f2050eb231137a2c6dd552e1ebdf -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 3ede22c08da5f2050eb231137a2c6dd552e1ebdf) +++ Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -16,10 +16,11 @@ using System.Windows.Input; using System.Windows.Interop; using System.Windows.Media.Imaging; -using Core.Common.Controls; using Core.Common.Controls.Dialogs; using Core.Common.Gui.Forms.MessageWindow; using Core.Common.Gui.Forms.Options; +using Core.Common.Gui.Properties; +using Core.Common.Gui.Theme; using Core.Common.Utils; using Core.Common.Utils.Collections; using Core.Common.Utils.Interop; @@ -31,10 +32,10 @@ using Xceed.Wpf.AvalonDock.Layout; using Xceed.Wpf.AvalonDock.Layout.Serialization; using Xceed.Wpf.AvalonDock.Themes; -using WindowsFormApplication = System.Windows.Forms.Application; using Button = Fluent.Button; using Cursors = System.Windows.Input.Cursors; using IWin32Window = System.Windows.Forms.IWin32Window; +using WindowsFormApplication = System.Windows.Forms.Application; namespace Core.Common.Gui.Forms.MainWindow { @@ -163,7 +164,7 @@ { get { - return Enumerable.OfType(Gui.ToolWindowViews).FirstOrDefault(); + return Gui.ToolWindowViews.OfType().FirstOrDefault(); } } @@ -224,7 +225,7 @@ public void SaveLayout() { - if (Properties.Settings.Default.autosaveWindowLayout) + if (Settings.Default.autosaveWindowLayout) { SaveWindowAppearance(); OnSaveLayout("normal"); @@ -522,7 +523,7 @@ private void AddRecentlyOpenedProjectsToFileMenu() { - var mruList = Properties.Settings.Default["mruList"] as StringCollection; + var mruList = Settings.Default["mruList"] as StringCollection; foreach (var recent in mruList) { @@ -574,7 +575,7 @@ private void CommitMruToSettings() { - var mruList = (StringCollection) Properties.Settings.Default["mruList"]; + var mruList = (StringCollection) Settings.Default["mruList"]; mruList.Clear(); @@ -633,7 +634,6 @@ private void OnFileSaveClicked(object sender, RoutedEventArgs e) { //TODO: Implement - return; // Original code: //var saveProject = Gui.CommandHandler.SaveProject(); @@ -643,7 +643,6 @@ private void OnFileSaveAsClicked(object sender, RoutedEventArgs e) { //TODO: Implement - return; // Original code: //var saveProject = Gui.CommandHandler.SaveProjectAs(); @@ -653,7 +652,6 @@ private void OnAfterProjectSaveOrOpen(bool actionSuccesful) { //TODO: Implement - return; // Original code: /* @@ -669,7 +667,6 @@ private void OnFileOpenClicked(object sender, RoutedEventArgs e) { //TODO: Implement - return; // Original code: //var succesful = Gui.CommandHandler.TryOpenExistingProject(); @@ -679,7 +676,6 @@ private void OnFileCloseClicked(object sender, RoutedEventArgs e) { //TODO: Implement - return; // Original code: //Gui.CommandHandler.TryCloseProject(); @@ -816,10 +812,10 @@ private void RestoreWindowAppearance() { WindowStartupLocation = WindowStartupLocation.Manual; - var x = Properties.Settings.Default.MainWindow_X; - var y = Properties.Settings.Default.MainWindow_Y; - var width = Properties.Settings.Default.MainWindow_Width; - var height = Properties.Settings.Default.MainWindow_Height; + var x = Settings.Default.MainWindow_X; + var y = Settings.Default.MainWindow_Y; + var width = Settings.Default.MainWindow_Width; + var height = Settings.Default.MainWindow_Height; var rec = new Rectangle(x, y, width, height); if (!IsVisibleOnAnyScreen(rec)) @@ -828,7 +824,7 @@ height = Screen.PrimaryScreen.Bounds.Height - 200; } - var fs = Properties.Settings.Default.MainWindow_FullScreen; + var fs = Settings.Default.MainWindow_FullScreen; Width = width; Height = height; if (fs) @@ -854,15 +850,15 @@ { if (WindowState == WindowState.Maximized) { - Properties.Settings.Default.MainWindow_FullScreen = true; + Settings.Default.MainWindow_FullScreen = true; } else { - Properties.Settings.Default.MainWindow_Width = (int) Width; - Properties.Settings.Default.MainWindow_Height = (int) Height; - Properties.Settings.Default.MainWindow_FullScreen = false; + Settings.Default.MainWindow_Width = (int) Width; + Settings.Default.MainWindow_Height = (int) Height; + Settings.Default.MainWindow_FullScreen = false; } - Properties.Settings.Default.Save(); + Settings.Default.Save(); } private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) @@ -899,7 +895,7 @@ private void UpdateRibbonExtensions() { // get all ribbon controls - ribbonCommandHandlers = Enumerable.Where(Gui.Plugins, p => p.RibbonCommandHandler != null).Select(p => p.RibbonCommandHandler).ToArray(); + ribbonCommandHandlers = Gui.Plugins.Where(p => p.RibbonCommandHandler != null).Select(p => p.RibbonCommandHandler).ToArray(); foreach (var ribbonExtension in ribbonCommandHandlers) { @@ -1158,7 +1154,7 @@ // Alt + Shift + M private void ShowMapLegendView(object sender, ExecutedRoutedEventArgs e) { - var mapContents = Enumerable.FirstOrDefault(Gui.ToolWindowViews, v => v.Text == Properties.Resources.ToolWindow_Name_Map); + var mapContents = Gui.ToolWindowViews.FirstOrDefault(v => v.Text == Properties.Resources.ToolWindow_Name_Map); if (mapContents != null) { Gui.ToolWindowViews.ActiveView = mapContents; @@ -1174,7 +1170,7 @@ // Alt + Shift + C private void ShowChartContentsWindow(object sender, ExecutedRoutedEventArgs e) { - var chartContents = Enumerable.FirstOrDefault(Gui.ToolWindowViews, v => v.Text == Properties.Resources.ToolWindow_Name_Chart); + var chartContents = Gui.ToolWindowViews.FirstOrDefault(v => v.Text == Properties.Resources.ToolWindow_Name_Chart); if (chartContents != null) { Gui.ToolWindowViews.ActiveView = chartContents; @@ -1183,7 +1179,7 @@ private void CanCloseDocumentTab(object sender, CanExecuteRoutedEventArgs e) { - e.CanExecute = Enumerable.Any(Gui.DocumentViews); + e.CanExecute = Gui.DocumentViews.Any(); } private void ButtonResetUILayout_Click(object sender, RoutedEventArgs e) @@ -1193,7 +1189,7 @@ private void OnAboutDialog_Clicked(object sender, RoutedEventArgs e) { - var aboutDialog = new SplashScreen.SplashScreen() + var aboutDialog = new SplashScreen.SplashScreen { HasProgress = false, VersionText = SettingsHelper.ApplicationVersion, Index: Core/Common/src/Core.Common.Gui/Forms/Options/OptionsDialog.cs =================================================================== diff -u -r00561a8c93e3a28b5f0e078fa7219a65408e931b -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Core/Common/src/Core.Common.Gui/Forms/Options/OptionsDialog.cs (.../OptionsDialog.cs) (revision 00561a8c93e3a28b5f0e078fa7219a65408e931b) +++ Core/Common/src/Core.Common.Gui/Forms/Options/OptionsDialog.cs (.../OptionsDialog.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -2,6 +2,7 @@ using System.Collections.ObjectModel; using System.Configuration; using System.Windows.Forms; +using Core.Common.Gui.Theme; using Core.Common.Gui.Properties; using Core.Common.Utils.Reflection; Index: Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs =================================================================== diff -u -ra795ec78ef4456ab9c8ad42029eb744093dfc600 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a795ec78ef4456ab9c8ad42029eb744093dfc600) +++ Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Runtime Version:4.0.30319.34209 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -887,6 +887,33 @@ } /// + /// Looks up a localized string similar to Toetsspoor. + /// + public static string FailureMechanismContributionView_GridColumn_Assessment { + get { + return ResourceManager.GetString("FailureMechanismContributionView_GridColumn_Assessment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Toegestane bijdrage aan faalkans [%]. + /// + public static string FailureMechanismContributionView_GridColumn_Contribution { + get { + return ResourceManager.GetString("FailureMechanismContributionView_GridColumn_Contribution", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Faalkansruimte (per jaar) [-]. + /// + public static string FailureMechanismContributionView_GridColumn_ProbabilitySpace { + get { + return ResourceManager.GetString("FailureMechanismContributionView_GridColumn_ProbabilitySpace", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap feed { Index: Core/Common/src/Core.Common.Gui/Properties/Resources.resx =================================================================== diff -u -ra795ec78ef4456ab9c8ad42029eb744093dfc600 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision a795ec78ef4456ab9c8ad42029eb744093dfc600) +++ Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -910,4 +910,13 @@ ..\Resources\OptionsHS.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + Faalkansruimte (per jaar) [-] + + + Toegestane bijdrage aan faalkans [%] + + + Toetsspoor + \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/Properties/Settings.Designer.cs =================================================================== diff -u -re3fe000640536463811a1051aedf6da711ee0f56 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Core/Common/src/Core.Common.Gui/Properties/Settings.Designer.cs (.../Settings.Designer.cs) (revision e3fe000640536463811a1051aedf6da711ee0f56) +++ Core/Common/src/Core.Common.Gui/Properties/Settings.Designer.cs (.../Settings.Designer.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -202,9 +202,9 @@ [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Generic")] - public global::Core.Common.Gui.ColorTheme colorTheme { + public global::Core.Common.Gui.Theme.ColorTheme colorTheme { get { - return ((global::Core.Common.Gui.ColorTheme)(this["colorTheme"])); + return ((global::Core.Common.Gui.Theme.ColorTheme)(this["colorTheme"])); } set { this["colorTheme"] = value; Index: Core/Common/src/Core.Common.Gui/Theme/ColorTheme.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/Theme/ColorTheme.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/Theme/ColorTheme.cs (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -0,0 +1,15 @@ +namespace Core.Common.Gui.Theme +{ + /// + /// Enumeration for the all the possible color themes in the application. + /// + public enum ColorTheme + { + Dark, + Light, + Metro, + Aero, + VS2010, + Generic + } +} \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/Theme/ColorThemeExtensions.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/Theme/ColorThemeExtensions.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/Theme/ColorThemeExtensions.cs (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -0,0 +1,22 @@ +using System; +using Core.Common.Gui.Properties; + +namespace Core.Common.Gui.Theme +{ + /// + /// Extension methods for the class + /// + public static class ColorThemeExtensions + { + /// + /// Gets the localized string from the based on the + /// name of the . + /// + /// The for which to get the localized name. + /// The localized name from the . + public static string Localized(this ColorTheme theme) + { + return Resources.ResourceManager.GetString(Enum.GetName(typeof(ColorTheme), theme)); + } + } +} \ No newline at end of file Index: Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj =================================================================== diff -u -rd6e6eadf4a2521df75b6d371bacbb181a43058a3 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision d6e6eadf4a2521df75b6d371bacbb181a43058a3) +++ Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -60,7 +60,8 @@ - + + Fisheye: Tag 75aa4fefacf584d5172dc3bdffd348b0aacb05a4 refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/Options/ColorThemeTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/test/Core.Common.Gui.Test/Theme/ColorThemeExtensionsTest.cs =================================================================== diff -u --- Core/Common/test/Core.Common.Gui.Test/Theme/ColorThemeExtensionsTest.cs (revision 0) +++ Core/Common/test/Core.Common.Gui.Test/Theme/ColorThemeExtensionsTest.cs (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -0,0 +1,37 @@ +using System; +using System.Collections.ObjectModel; +using Core.Common.Gui.Properties; +using Core.Common.Gui.Theme; +using NUnit.Framework; + +namespace Core.Common.Gui.Test.Theme +{ + [TestFixture] + public class ColorThemeExtensionsTest + { + [Test] + public void Localized_ForEveryItem_ExpectedTranslatedString() + { + // Setup + var nameList = new[] + { + Resources.Dark, + Resources.Light, + Resources.Metro, + Resources.Aero, + Resources.VS2010, + Resources.Generic + }; + var translations = new Collection(); + + // Call + foreach (ColorTheme item in Enum.GetValues(typeof(ColorTheme))) + { + translations.Add(item.Localized()); + } + + // Assert + CollectionAssert.AreEqual(nameList, translations); + } + } +} \ No newline at end of file Index: Core/Common/test/Core.Common.Gui.Test/Theme/ColorThemeTest.cs =================================================================== diff -u --- Core/Common/test/Core.Common.Gui.Test/Theme/ColorThemeTest.cs (revision 0) +++ Core/Common/test/Core.Common.Gui.Test/Theme/ColorThemeTest.cs (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -0,0 +1,35 @@ +using System; +using Core.Common.Gui.Theme; +using NUnit.Framework; + +namespace Core.Common.Gui.Test.Theme +{ + [TestFixture] + public class ColorThemeTest + { + [Test] + public void ColorTheme_Values_HasSix() + { + // Call & Assert + Assert.AreEqual(6, Enum.GetValues(typeof(ColorTheme)).Length); + } + + [Test] + public void ColorTheme_GetNames_HasSix() + { + // Setup + var nameList = new[] + { + "Dark", + "Light", + "Metro", + "Aero", + "VS2010", + "Generic" + }; + + // Call & Assert + CollectionAssert.AreEqual(nameList, Enum.GetNames(typeof(ColorTheme))); + } + } +} \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorer.cs =================================================================== diff -u -rd37e350b3c62d61768313c57c2d8d8d05d22458a -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorer.cs (.../ProjectExplorer.cs) (revision d37e350b3c62d61768313c57c2d8d8d05d22458a) +++ Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorer.cs (.../ProjectExplorer.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -33,7 +33,6 @@ treeViewPanel.Controls.Add(ProjectTreeView); gui.DocumentViews.ActiveViewChanged += DocumentViewsActiveViewChanged; - ProjectTreeView.TreeView.OnUpdate += (s,e) => gui.UpdateToolTips(); } public ProjectTreeView ProjectTreeView { get; private set; } Index: Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorerGuiPlugin.cs =================================================================== diff -u -r074232b001ecb5ae110c0b95c05264d4372cbfb5 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorerGuiPlugin.cs (.../ProjectExplorerGuiPlugin.cs) (revision 074232b001ecb5ae110c0b95c05264d4372cbfb5) +++ Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorerGuiPlugin.cs (.../ProjectExplorerGuiPlugin.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -62,6 +62,7 @@ ProjectExplorer.ProjectTreeView.Project = Gui.Project; ProjectExplorer.Text = Properties.Resources.ProjectExplorerPluginGui_InitializeProjectTreeView_Project_Explorer; + ProjectExplorer.ProjectTreeView.TreeView.OnUpdate += (s, e) => Gui.UpdateToolTips(); } //add project treeview as a toolwindowview. Index: Ringtoets.sln =================================================================== diff -u -rd6e6eadf4a2521df75b6d371bacbb181a43058a3 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets.sln (.../Ringtoets.sln) (revision d6e6eadf4a2521df75b6d371bacbb181a43058a3) +++ Ringtoets.sln (.../Ringtoets.sln) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -223,6 +223,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.Piping.Data.TestUtil.Test", "Ringtoets\Piping\test\Ringtoets.Piping.Data.TestUtil.Test\Ringtoets.Piping.Data.TestUtil.Test.csproj", "{35B78215-420B-4D7D-9959-9E9010601200}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.Common.Data.Test", "Ringtoets\Common\test\Ringtoets.Common.Data.Test\Ringtoets.Common.Data.Test.csproj", "{7BABA02F-4809-43D2-93E5-DA9ED69BDDE2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution CreateInstaller|x86 = CreateInstaller|x86 @@ -888,6 +890,14 @@ {35B78215-420B-4D7D-9959-9E9010601200}.Release|x86.Build.0 = Release|x86 {35B78215-420B-4D7D-9959-9E9010601200}.ReleaseForCodeCoverage|x86.ActiveCfg = ReleaseForCodeCoverage|x86 {35B78215-420B-4D7D-9959-9E9010601200}.ReleaseForCodeCoverage|x86.Build.0 = ReleaseForCodeCoverage|x86 + {7BABA02F-4809-43D2-93E5-DA9ED69BDDE2}.CreateInstaller|x86.ActiveCfg = Release|x86 + {7BABA02F-4809-43D2-93E5-DA9ED69BDDE2}.CreateInstallerWithDemoProject|x86.ActiveCfg = Release|x86 + {7BABA02F-4809-43D2-93E5-DA9ED69BDDE2}.Debug|x86.ActiveCfg = Debug|x86 + {7BABA02F-4809-43D2-93E5-DA9ED69BDDE2}.Debug|x86.Build.0 = Debug|x86 + {7BABA02F-4809-43D2-93E5-DA9ED69BDDE2}.Release|x86.ActiveCfg = Release|x86 + {7BABA02F-4809-43D2-93E5-DA9ED69BDDE2}.Release|x86.Build.0 = Release|x86 + {7BABA02F-4809-43D2-93E5-DA9ED69BDDE2}.ReleaseForCodeCoverage|x86.ActiveCfg = ReleaseForCodeCoverage|x86 + {7BABA02F-4809-43D2-93E5-DA9ED69BDDE2}.ReleaseForCodeCoverage|x86.Build.0 = ReleaseForCodeCoverage|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -962,6 +972,7 @@ {4D840673-3812-4338-A352-84854E32B8A0} = {0590D3BB-EB3E-4B53-BD64-1725E1CBB1F4} {D4200F43-3F72-4F42-AF0A-8CED416A38EC} = {0590D3BB-EB3E-4B53-BD64-1725E1CBB1F4} {886FDBE5-7065-4AB9-A894-869DBFD4E440} = {B5F4F5A5-FD36-405D-ABA1-56C270207C8F} + {7BABA02F-4809-43D2-93E5-DA9ED69BDDE2} = {B5F4F5A5-FD36-405D-ABA1-56C270207C8F} {3ED34ACD-41C9-4251-81EC-7493E0BFF57D} = {F8FFD6DD-19DA-47CE-A0BD-53F4E7D8BB86} {1F0D20C2-7F04-431D-AF22-95A31FD53733} = {F8FFD6DD-19DA-47CE-A0BD-53F4E7D8BB86} {492FFA2C-351E-48DB-BA51-B837657BAF2F} = {F8FFD6DD-19DA-47CE-A0BD-53F4E7D8BB86} Index: Ringtoets/Common/src/Ringtoets.Common.Data/BaseFailureMechanism.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Data/BaseFailureMechanism.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Data/BaseFailureMechanism.cs (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -0,0 +1,30 @@ +using System; +using Core.Common.Base; +using Ringtoets.Common.Data.Properties; + +namespace Ringtoets.Common.Data +{ + + public abstract class BaseFailureMechanism : Observable, IFailureMechanism + { + private double contribution; + + public double Contribution + { + get + { + return contribution; + } + set + { + if (value < 0 || value > 100) + { + throw new ArgumentException(Resources.FailureMechanism_Contribution_Value_should_be_in_interval_0_100, "value"); + } + contribution = value; + } + } + + public string Name { get; set; } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Data/IFailureMechanism.cs =================================================================== diff -u -r5c044a6799b45bec77af170dca0a84bc434c5f6f -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Common/src/Ringtoets.Common.Data/IFailureMechanism.cs (.../IFailureMechanism.cs) (revision 5c044a6799b45bec77af170dca0a84bc434c5f6f) +++ Ringtoets/Common/src/Ringtoets.Common.Data/IFailureMechanism.cs (.../IFailureMechanism.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -1,10 +1,22 @@ -namespace Ringtoets.Common.Data +using System; + +namespace Ringtoets.Common.Data { /// /// Defines a failure mechanism. /// public interface IFailureMechanism { - + /// + /// Gets the amount of contribution as a percentage (0-100) for the + /// as part of the overall verdict. + /// + /// Thrown when the is not in interval [0-100]. + double Contribution { get; set; } + + /// + /// The name of the . + /// + string Name { get; } } } \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs =================================================================== diff -u -rf11bebcc0a2f2356ef04653812d383b270929888 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f11bebcc0a2f2356ef04653812d383b270929888) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 +// Runtime Version:4.0.30319.34209 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -79,6 +79,15 @@ } /// + /// Looks up a localized string similar to De waarde voor de toegestane bijdrage aan faalkans moet in interval [0-100] liggen.. + /// + public static string FailureMechanism_Contribution_Value_should_be_in_interval_0_100 { + get { + return ResourceManager.GetString("FailureMechanism_Contribution_Value_should_be_in_interval_0_100", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Locaties. /// public static string FailureMechanism_Locations_DisplayName { Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx =================================================================== diff -u -rf11bebcc0a2f2356ef04653812d383b270929888 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision f11bebcc0a2f2356ef04653812d383b270929888) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -123,6 +123,9 @@ Randvoorwaarden + + De waarde voor de toegestane bijdrage aan faalkans moet in interval [0-100] liggen. + Locaties Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj =================================================================== diff -u -r3f1a2b8718a744b49b160c89df46dee6b7fb5fdd -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 3f1a2b8718a744b49b160c89df46dee6b7fb5fdd) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -39,6 +39,7 @@ Properties\GlobalAssembly.cs + @@ -54,6 +55,12 @@ Designer + + + {3BBFD65B-B277-4E50-AE6D-BD24C3434609} + Core.Common.Base + + + \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/packages.config =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/packages.config (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/packages.config (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSectionBase.cs =================================================================== diff -u -r6fc99be8198e5795ca4be54719dab3d1be3c6299 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSectionBase.cs (.../AssessmentSectionBase.cs) (revision 6fc99be8198e5795ca4be54719dab3d1be3c6299) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSectionBase.cs (.../AssessmentSectionBase.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -4,6 +4,7 @@ using Ringtoets.Common.Data; using Ringtoets.Common.Placeholder; +using Ringtoets.Integration.Data.Contribution; using Ringtoets.Integration.Data.Properties; namespace Ringtoets.Integration.Data @@ -20,7 +21,6 @@ { Name = ""; ReferenceLine = new InputPlaceholder(Resources.ReferenceLine_DisplayName); - FailureMechanismContribution = new FailureMechanismContribution(3000); HydraulicBoundaryDatabase = new InputPlaceholder(Resources.HydraulicBoundaryDatabase_DisplayName); } @@ -37,7 +37,7 @@ /// /// Gets or sets the contribution of each failure mechanism available in this assessment section. /// - public FailureMechanismContribution FailureMechanismContribution { get; private set; } + public FailureMechanismContribution FailureMechanismContribution { get; protected set; } /// /// Gets or sets the hydraulic boundary database. Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/Contribution/FailureMechanismContribution.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Data/Contribution/FailureMechanismContribution.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/Contribution/FailureMechanismContribution.cs (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Core.Common.Base; +using Core.Common.Utils.Collections; +using Ringtoets.Common.Data; +using Ringtoets.Integration.Data.Properties; + +namespace Ringtoets.Integration.Data.Contribution +{ + /// + /// This class represents the distribution of contribution for all failure mechanism. + /// + public class FailureMechanismContribution : Observable + { + private readonly ICollection distribution = new List(); + private int norm; + + /// + /// Creates a new instance of . Values are taken from the + /// and one item is added with a value of + /// which represents the contribution of any other failure mechanisms. + /// + /// The of on which to base + /// the . + /// The collective contribution for other failure mechanisms. + /// The norm defined on a assessment section. + /// Thrown when: + /// + /// any of the has a value for not in interval [0,100]. + /// the value of is not in interval [0,100] + /// + /// + /// Thrown when is null. + public FailureMechanismContribution(IEnumerable failureMechanisms, double otherContribution, int norm) + { + if (failureMechanisms == null) + { + throw new ArgumentNullException("failureMechanisms", Resources.FailureMechanismContribution_FailureMechanismContribution_Can_not_create_FailureMechanismContribution_without_FailureMechanism_collection); + } + this.norm = norm; + failureMechanisms.ForEach(AddContributionItem); + AddOtherContributionItem(otherContribution); + } + + /// + /// Gets or sets the norm which has been defined on the assessment section. + /// + public int Norm + { + get + { + return norm; + } + set + { + norm = value; + distribution.ForEach(d => d.Norm = norm); + } + } + + /// + /// Gets the distribution of failure mechanism contributions. + /// + public IEnumerable Distribution + { + get + { + return distribution; + } + } + + /// + /// Adds a based on . + /// + /// The to add a for. + /// Thrown when is null. + private void AddContributionItem(IFailureMechanism failureMechanism) + { + distribution.Add(new FailureMechanismContributionItem(failureMechanism, norm)); + } + + /// + /// Adds a representing all other failure mechanisms not in the failure mechanism + /// list supported within Ringtoets. + /// + /// The contribution to set for other failure mechanisms. + /// Thrown when is not in interval [0,100] + private void AddOtherContributionItem(double otherContribution) + { + var otherFailureMechanism = new OtherFailureMechanism + { + Contribution = otherContribution + }; + var otherContributionItem = new FailureMechanismContributionItem(otherFailureMechanism, norm); + distribution.Add(otherContributionItem); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/Contribution/FailureMechanismContributionItem.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Data/Contribution/FailureMechanismContributionItem.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/Contribution/FailureMechanismContributionItem.cs (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -0,0 +1,57 @@ +using System; +using Ringtoets.Common.Data; +using Ringtoets.Integration.Data.Properties; + +namespace Ringtoets.Integration.Data.Contribution +{ + /// + /// This class represents an amount for which a failure mechanism will contribute to the + /// overall verdict of a dike section. + /// + public class FailureMechanismContributionItem + { + /// + /// Creates a new instance of . With + /// , and set. + /// + /// The for which the contribution is defined. + /// The norm used to calculate the probability space. + /// Thrown when is null. + public FailureMechanismContributionItem(IFailureMechanism failureMechanism, int norm) + { + if (failureMechanism == null) + { + throw new ArgumentNullException("failureMechanism", Resources.FailureMechanismContributionItem_Can_not_create_contribution_item_without_failure_mechanism); + } + Assessment = failureMechanism.Name; + Contribution = failureMechanism.Contribution; + Norm = norm; + } + + /// + /// Gets the name of the assessment for which to configure the . + /// + public string Assessment { get; private set; } + + /// + /// Gets the amount of contribution as a percentage. + /// + public double Contribution { get; private set; } + + /// + /// Gets the probability space per year for the . + /// + public double ProbabilitySpace + { + get + { + return (Norm / Contribution) * 100; + } + } + + /// + /// Gets or sets the norm of the complete dike section. + /// + internal double Norm { private get; set; } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/Contribution/OtherFailureMechanism.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Data/Contribution/OtherFailureMechanism.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/Contribution/OtherFailureMechanism.cs (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -0,0 +1,21 @@ +using System; +using Ringtoets.Common.Data; +using Ringtoets.Integration.Data.Properties; + +namespace Ringtoets.Integration.Data.Contribution +{ + /// + /// This class represents a failure mechanism which has no representative within Ringtoets but + /// contributes to the overall verdict nonetheless. + /// + public class OtherFailureMechanism : BaseFailureMechanism + { + /// + /// Creates a new instance of . + /// + public OtherFailureMechanism() + { + Name = Resources.OtherFailureMechanism_DisplayName; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/DikeAssessmentSection.cs =================================================================== diff -u -r8ed458d0460c2bab956a7c3a75c2cdb5c1aae3e6 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/DikeAssessmentSection.cs (.../DikeAssessmentSection.cs) (revision 8ed458d0460c2bab956a7c3a75c2cdb5c1aae3e6) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/DikeAssessmentSection.cs (.../DikeAssessmentSection.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -1,5 +1,6 @@ using System.Collections.Generic; using Ringtoets.Common.Data; +using Ringtoets.Integration.Data.Contribution; using Ringtoets.Integration.Data.Placeholders; using Ringtoets.Integration.Data.Properties; using Ringtoets.Piping.Data; @@ -9,7 +10,7 @@ /// /// The dike-based section to be assessed by the user for safety in regards of various failure mechanisms. /// - public class DikeAssessmentSection : AssessmentSectionBase + public sealed class DikeAssessmentSection : AssessmentSectionBase { /// /// Initializes a new instance of the class. @@ -18,15 +19,44 @@ { Name = Resources.DikeAssessmentSection_DisplayName; - PipingFailureMechanism = new PipingFailureMechanism(); - GrassErosionFailureMechanism = new FailureMechanismPlaceholder(Resources.GrassErosionFailureMechanism_DisplayName); - MacrostabilityInwardFailureMechanism = new FailureMechanismPlaceholder(Resources.MacrostabilityInwardFailureMechanism_DisplayName); - OvertoppingFailureMechanism = new FailureMechanismPlaceholder(Resources.OvertoppingFailureMechanism_DisplayName); - ClosingFailureMechanism = new FailureMechanismPlaceholder(Resources.ClosingFailureMechanism_DisplayName); - FailingOfConstructionFailureMechanism = new FailureMechanismPlaceholder(Resources.FailingOfConstructionFailureMechanism_DisplayName); - StoneRevetmentFailureMechanism = new FailureMechanismPlaceholder(Resources.StoneRevetmentFailureMechanism_DisplayName); - AsphaltRevetmentFailureMechanism = new FailureMechanismPlaceholder(Resources.AsphaltRevetmentFailureMechanism_DisplayName); - GrassRevetmentFailureMechanism = new FailureMechanismPlaceholder(Resources.GrassRevetmentFailureMechanism_DisplayName); + PipingFailureMechanism = new PipingFailureMechanism + { + Contribution = 24 + }; + GrassErosionFailureMechanism = new FailureMechanismPlaceholder(Resources.GrassErosionFailureMechanism_DisplayName) + { + Contribution = 24 + }; + MacrostabilityInwardFailureMechanism = new FailureMechanismPlaceholder(Resources.MacrostabilityInwardFailureMechanism_DisplayName) + { + Contribution = 4 + }; + OvertoppingFailureMechanism = new FailureMechanismPlaceholder(Resources.OvertoppingFailureMechanism_DisplayName) + { + Contribution = 2 + }; + ClosingFailureMechanism = new FailureMechanismPlaceholder(Resources.ClosingFailureMechanism_DisplayName) + { + Contribution = 4 + }; + FailingOfConstructionFailureMechanism = new FailureMechanismPlaceholder(Resources.FailingOfConstructionFailureMechanism_DisplayName) + { + Contribution = 2 + }; + StoneRevetmentFailureMechanism = new FailureMechanismPlaceholder(Resources.StoneRevetmentFailureMechanism_DisplayName) + { + Contribution = 4 + }; + AsphaltRevetmentFailureMechanism = new FailureMechanismPlaceholder(Resources.AsphaltRevetmentFailureMechanism_DisplayName) + { + Contribution = 3 + }; + GrassRevetmentFailureMechanism = new FailureMechanismPlaceholder(Resources.GrassRevetmentFailureMechanism_DisplayName) + { + Contribution = 3 + }; + + FailureMechanismContribution = new FailureMechanismContribution(GetFailureMechanisms(), 30, 3000); } /// @@ -83,7 +113,7 @@ yield return ClosingFailureMechanism; yield return FailingOfConstructionFailureMechanism; yield return StoneRevetmentFailureMechanism; - yield return AsphaltRevetmentFailureMechanism; + yield return AsphaltRevetmentFailureMechanism; yield return GrassRevetmentFailureMechanism; } } Fisheye: Tag 75aa4fefacf584d5172dc3bdffd348b0aacb05a4 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Data/FailureMechanismContribution.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 75aa4fefacf584d5172dc3bdffd348b0aacb05a4 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Data/FailureMechanismContributionItem.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/Placeholders/FailureMechanismPlaceholder.cs =================================================================== diff -u -rf11bebcc0a2f2356ef04653812d383b270929888 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/Placeholders/FailureMechanismPlaceholder.cs (.../FailureMechanismPlaceholder.cs) (revision f11bebcc0a2f2356ef04653812d383b270929888) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/Placeholders/FailureMechanismPlaceholder.cs (.../FailureMechanismPlaceholder.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -1,6 +1,5 @@ using Ringtoets.Common.Data; using Ringtoets.Common.Placeholder; - using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; namespace Ringtoets.Integration.Data.Placeholders @@ -41,5 +40,7 @@ /// Gets the calculation results for this failure mechanism. /// public OutputPlaceholder AssessmentResult { get; private set; } + + public double Contribution { get; set; } } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/Properties/Resources.Designer.cs =================================================================== diff -u -r5600bdc79b866be64b1c51026ce5f13c1f1c9226 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5600bdc79b866be64b1c51026ce5f13c1f1c9226) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -124,15 +124,26 @@ } /// - /// Looks up a localized string similar to Overig. + /// Looks up a localized string similar to Kan geen bijdrageoverzicht maken zonder faalmechanismen.. /// - public static string FailureMechanismContribution_FailureMechanismContribution_Other { + public static string FailureMechanismContribution_FailureMechanismContribution_Can_not_create_FailureMechanismContribution_without_FailureMechanism_collection { get { - return ResourceManager.GetString("FailureMechanismContribution_FailureMechanismContribution_Other", resourceCulture); + return ResourceManager.GetString("FailureMechanismContribution_FailureMechanismContribution_Can_not_create_FailureM" + + "echanismContribution_without_FailureMechanism_collection", resourceCulture); } } /// + /// Looks up a localized string similar to Kan geen bijdrage item maken zonder een faalmechanisme.. + /// + public static string FailureMechanismContributionItem_Can_not_create_contribution_item_without_failure_mechanism { + get { + return ResourceManager.GetString("FailureMechanismContributionItem_Can_not_create_contribution_item_without_failure" + + "_mechanism", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Dijken - Graserosie kruin en binnentalud. /// public static string GrassErosionFailureMechanism_DisplayName { @@ -169,6 +180,15 @@ } /// + /// Looks up a localized string similar to Overig. + /// + public static string OtherFailureMechanism_DisplayName { + get { + return ResourceManager.GetString("OtherFailureMechanism_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Kunstwerken - Overslag en overloop. /// public static string OvertoppingFailureMechanism_DisplayName { Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/Properties/Resources.resx =================================================================== diff -u -r5600bdc79b866be64b1c51026ce5f13c1f1c9226 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/Properties/Resources.resx (.../Resources.resx) (revision 5600bdc79b866be64b1c51026ce5f13c1f1c9226) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/Properties/Resources.resx (.../Resources.resx) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -159,7 +159,13 @@ Dijken - Grasbekledingen - + Overig + + Kan geen bijdrage item maken zonder een faalmechanisme. + + + Kan geen bijdrageoverzicht maken zonder faalmechanismen. + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/Ringtoets.Integration.Data.csproj =================================================================== diff -u -r3f1a2b8718a744b49b160c89df46dee6b7fb5fdd -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/Ringtoets.Integration.Data.csproj (.../Ringtoets.Integration.Data.csproj) (revision 3f1a2b8718a744b49b160c89df46dee6b7fb5fdd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/Ringtoets.Integration.Data.csproj (.../Ringtoets.Integration.Data.csproj) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -40,11 +40,12 @@ Properties\GlobalAssembly.cs - - + + + Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/NodePresenters/FailureMechanismContributionNodePresenter.cs =================================================================== diff -u -r0a222f4f3c0054ec9cc70f94480c0dc504fea411 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/NodePresenters/FailureMechanismContributionNodePresenter.cs (.../FailureMechanismContributionNodePresenter.cs) (revision 0a222f4f3c0054ec9cc70f94480c0dc504fea411) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/NodePresenters/FailureMechanismContributionNodePresenter.cs (.../FailureMechanismContributionNodePresenter.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -3,6 +3,7 @@ using Core.Common.Gui; using Ringtoets.Common.Forms.NodePresenters; using Ringtoets.Integration.Data; +using Ringtoets.Integration.Data.Contribution; using Ringtoets.Integration.Forms.Properties; namespace Ringtoets.Integration.Forms.NodePresenters Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.Designer.cs =================================================================== diff -u -r5600bdc79b866be64b1c51026ce5f13c1f1c9226 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.Designer.cs (.../FailureMechanismContributionView.Designer.cs) (revision 5600bdc79b866be64b1c51026ce5f13c1f1c9226) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.Designer.cs (.../FailureMechanismContributionView.Designer.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -54,12 +54,16 @@ // // probabilityDistributionGrid // + this.probabilityDistributionGrid.AllowUserToResizeColumns = false; + this.probabilityDistributionGrid.AllowUserToResizeRows = false; resources.ApplyResources(this.probabilityDistributionGrid, "probabilityDistributionGrid"); this.probabilityDistributionGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.tableLayoutPanel.SetColumnSpan(this.probabilityDistributionGrid, 3); this.probabilityDistributionGrid.Name = "probabilityDistributionGrid"; this.probabilityDistributionGrid.ReadOnly = true; this.probabilityDistributionGrid.RowHeadersVisible = false; + this.probabilityDistributionGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.probabilityDistributionGrid.TabStop = false; // // normInput // Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs =================================================================== diff -u -rffe7599d814964e179f97e33e4c3713b8ea869f8 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs (.../FailureMechanismContributionView.cs) (revision ffe7599d814964e179f97e33e4c3713b8ea869f8) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs (.../FailureMechanismContributionView.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -3,7 +3,10 @@ using System.Windows.Forms; using Core.Common.Base; using Core.Common.Controls; +using Core.Common.Gui.Properties; +using Core.Common.Utils.Reflection; using Ringtoets.Integration.Data; +using Ringtoets.Integration.Data.Contribution; namespace Ringtoets.Integration.Forms.Views { @@ -105,27 +108,31 @@ private void InitializeGridColumns() { + var assessmentName = TypeUtils.GetMemberName(e => e.Assessment); + var columnNameFormat = "column_{0}"; var assessmentColumn = new DataGridViewTextBoxColumn { - DataPropertyName = "Assessment", - HeaderText = "Toetsspoor", - Name = "column_Assessment", + DataPropertyName = assessmentName, + HeaderText = Resources.FailureMechanismContributionView_GridColumn_Assessment, + Name = string.Format(columnNameFormat, assessmentName), AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader }; + var contributionName = TypeUtils.GetMemberName(e => e.Contribution); var probabilityColumn = new DataGridViewTextBoxColumn { - DataPropertyName = "Probability", - HeaderText = "Toegestane bijdrage aan faalkans [%]", - Name = "column_Probability", + DataPropertyName = contributionName, + HeaderText = Resources.FailureMechanismContributionView_GridColumn_Contribution, + Name = string.Format(columnNameFormat, contributionName), AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader }; + var probabilitySpaceName = TypeUtils.GetMemberName(e => e.ProbabilitySpace); var probabilityPerYearColumn = new DataGridViewTextBoxColumn { - DataPropertyName = "ProbabilityPerYear", - HeaderText = "Faalkansruimte (per jaar)", - Name = "column_ProbabilityPerYear", + DataPropertyName = probabilitySpaceName, + HeaderText = Resources.FailureMechanismContributionView_GridColumn_ProbabilitySpace, + Name = string.Format(columnNameFormat, probabilitySpaceName), AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill }; Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.resx =================================================================== diff -u -r5600bdc79b866be64b1c51026ce5f13c1f1c9226 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.resx (.../FailureMechanismContributionView.resx) (revision 5600bdc79b866be64b1c51026ce5f13c1f1c9226) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.resx (.../FailureMechanismContributionView.resx) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -153,18 +153,6 @@ Top, Bottom, Left, Right - - Top, Left, Right - - - 68, 3 - - - 74, 20 - - - 3 - normInput @@ -177,27 +165,6 @@ 1 - - Top, Bottom, Left - - - NoControl - - - 148, 0 - - - 50, 26 - - - 1 - - - per jaar - - - MiddleLeft - perYearLabel @@ -244,7 +211,7 @@ 206, 139 - 2 + 1 probabilityDistributionGrid @@ -258,6 +225,63 @@ 0 + + Top, Left, Right + + + 68, 3 + + + 74, 20 + + + 0 + + + normInput + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel + + + 1 + + + Top, Bottom, Left + + + NoControl + + + 148, 0 + + + 50, 26 + + + 1 + + + per jaar + + + MiddleLeft + + + perYearLabel + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel + + + 3 + True Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs =================================================================== diff -u -r2ea5055c818880a8c2e03f74e2f4e19a427fbb8e -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 2ea5055c818880a8c2e03f74e2f4e19a427fbb8e) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -8,6 +8,7 @@ using Ringtoets.Common.Forms.NodePresenters; using Ringtoets.Integration.Data; +using Ringtoets.Integration.Data.Contribution; using Ringtoets.Integration.Data.Properties; using Ringtoets.Integration.Forms.NodePresenters; using Ringtoets.Integration.Forms.PropertyClasses; Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Contribution/FailureMechanismContributionItemTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Contribution/FailureMechanismContributionItemTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Contribution/FailureMechanismContributionItemTest.cs (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -0,0 +1,86 @@ +using System; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data; +using Ringtoets.Integration.Data.Contribution; +using Ringtoets.Integration.Data.Properties; + +namespace Ringtoets.Integration.Data.Test.Contribution +{ + [TestFixture] + public class FailureMechanismContributionItemTest + { + private MockRepository mockRepository; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + } + + [Test] + public void Constructor_WithoutFailureMechanism_ThrowsArgumentNullException() + { + // Setup + + // Call + TestDelegate test = () => new FailureMechanismContributionItem(null, new Random(21).Next()); + + // Assert + var message = Assert.Throws(test).Message; + StringAssert.StartsWith(Resources.FailureMechanismContributionItem_Can_not_create_contribution_item_without_failure_mechanism, message); + StringAssert.EndsWith("failureMechanism", message); + } + + [Test] + public void Constructor_WithFailureMechanism_SetProperties() + { + // Setup + string name = "SomeName"; + double contribution = new Random(21).NextDouble(); + + var failureMechanism = mockRepository.StrictMock(); + + failureMechanism.Expect(fm => fm.Name).Return(name); + failureMechanism.Expect(fm => fm.Contribution).Return(contribution); + + mockRepository.ReplayAll(); + + // Call + var result = new FailureMechanismContributionItem(failureMechanism, new Random(21).Next()); + + // Assert + Assert.AreEqual(name,result.Assessment); + Assert.AreEqual(contribution,result.Contribution); + + mockRepository.VerifyAll(); + } + + [Test] + [TestCase(20, 2000, 10000)] + [TestCase(3, 100, 10000/3.0)] + [TestCase(25.5, 2550, 10000)] + public void ProbabilitySpace_DifferentContributionAndNorm_ReturnsExpectedValue(double contribution, int norm, double expectedResult) + { + // Setup + string name = "SomeName"; + + var failureMechanism = mockRepository.StrictMock(); + + failureMechanism.Expect(fm => fm.Name).Return(name); + failureMechanism.Expect(fm => fm.Contribution).Return(contribution); + + mockRepository.ReplayAll(); + + var contributionItem = new FailureMechanismContributionItem(failureMechanism, norm); + + // Call + var result = contributionItem.ProbabilitySpace; + + // Assert + Assert.AreEqual(expectedResult, result, double.Epsilon); + + mockRepository.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Contribution/FailureMechanismContributionTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Contribution/FailureMechanismContributionTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Contribution/FailureMechanismContributionTest.cs (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -0,0 +1,138 @@ +using System; +using System.Collections.ObjectModel; +using System.Linq; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data; +using Ringtoets.Integration.Data.Contribution; +using Ringtoets.Integration.Data.Properties; + +namespace Ringtoets.Integration.Data.Test.Contribution +{ + [TestFixture] + public class FailureMechanismContributionTest + { + private MockRepository mockRepository; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + } + + [Test] + public void Constructor_WithNullFailureMechanisms_ThrowsArgumentNullException() + { + // Setup + var random = new Random(21); + + // Call + TestDelegate test = () => new FailureMechanismContribution(null, random.NextDouble(), random.Next()); + + // Assert + var message = Assert.Throws(test).Message; + StringAssert.StartsWith(Resources.FailureMechanismContribution_FailureMechanismContribution_Can_not_create_FailureMechanismContribution_without_FailureMechanism_collection, message); + StringAssert.EndsWith("failureMechanisms", message); + } + + [Test] + public void Constructor_WithNullFailureMechanism_ThrowsArgumentNullException() + { + // Setup + var random = new Random(21); + + // Call + TestDelegate test = () => new FailureMechanismContribution(new IFailureMechanism[]{null}, random.NextDouble(), random.Next()); + + // Assert + var message = Assert.Throws(test).Message; + StringAssert.StartsWith(Resources.FailureMechanismContributionItem_Can_not_create_contribution_item_without_failure_mechanism, message); + StringAssert.EndsWith("failureMechanism", message); + } + + [Test] + [TestCase(-10)] + [TestCase(-1e-6)] + [TestCase(100+1e-6)] + [TestCase(150)] + public void Constructor_OtherContributionOutside0To100_ArgumentException(double contribution) + { + // Setup + var random = new Random(21); + + // Call + TestDelegate test = () => new FailureMechanismContribution(new IFailureMechanism[] { }, contribution, random.Next()); + + // Assert + var message = Assert.Throws(test).Message; + StringAssert.StartsWith(Common.Data.Properties.Resources.FailureMechanism_Contribution_Value_should_be_in_interval_0_100, message); + StringAssert.EndsWith("value", message); + } + + [Test] + public void Constructor_EmptyFailureMechanisms_OnlyOtherFailureMechanismAdded() + { + // Setup + var random = new Random(21); + var otherContribution = (double)random.Next(0, 100); + var norm = random.Next(); + + // Call + var result = new FailureMechanismContribution(new IFailureMechanism[] { }, otherContribution, norm); + + // Assert + Assert.AreEqual(1, result.Distribution.Count()); + Assert.AreEqual(otherContribution, result.Distribution.ElementAt(0).Contribution); + Assert.AreEqual((norm / otherContribution) * 100, result.Distribution.ElementAt(0).ProbabilitySpace); + Assert.AreEqual(norm, result.Norm); + } + + [Test] + [TestCase(1)] + [TestCase(2)] + [TestCase(5)] + public void Constructor_OneOrMoreFailureMechanisms_DistributionForFailureMechanismsWithOtherAtEnd(int failureMechanismCount) + { + // Setup + var random = new Random(21); + var otherContribution = (double)random.Next(0, 100); + + var failureMechanismNames = new Collection(); + var failureMechanismContributions = new Collection(); + + var failureMechanisms = new Collection(); + var namePrefixFormat = "mechanism_{0}"; + + for (var i = 0; i < failureMechanismCount; i++) + { + var name = string.Format(namePrefixFormat, i); + var contribution = random.Next(0, 100); + var failureMechanism = mockRepository.StrictMock(); + failureMechanism.Expect(fm => fm.Name).Return(name); + failureMechanism.Expect(fm => fm.Contribution).Return(contribution); + + failureMechanisms.Add(failureMechanism); + failureMechanismNames.Add(name); + failureMechanismContributions.Add(contribution); + } + + failureMechanismNames.Add(Resources.OtherFailureMechanism_DisplayName); + failureMechanismContributions.Add(otherContribution); + + mockRepository.ReplayAll(); + var norm = random.Next(); + + // Call + var result = new FailureMechanismContribution(failureMechanisms, otherContribution, norm); + + // Assert + Assert.AreEqual(failureMechanismCount + 1, result.Distribution.Count()); + + CollectionAssert.AreEqual(failureMechanismNames, result.Distribution.Select(d => d.Assessment)); + CollectionAssert.AreEqual(failureMechanismContributions, result.Distribution.Select(d => d.Contribution)); + CollectionAssert.AreEqual(failureMechanismContributions.Select(c => (norm / c) * 100), result.Distribution.Select(d => d.ProbabilitySpace)); + + mockRepository.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Contribution/OtherFailureMechanismTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Contribution/OtherFailureMechanismTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Contribution/OtherFailureMechanismTest.cs (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -0,0 +1,20 @@ +using NUnit.Framework; +using Ringtoets.Integration.Data.Contribution; +using Ringtoets.Integration.Data.Properties; + +namespace Ringtoets.Integration.Data.Test.Contribution +{ + [TestFixture] + public class OtherFailureMechanismTest + { + [Test] + public void Constructor_Always_NameSet() + { + // Call + var result = new OtherFailureMechanism(); + + // Assert + Assert.AreEqual(Resources.OtherFailureMechanism_DisplayName, result.Name); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/DikeAssessmentSectionTest.cs =================================================================== diff -u -r6fc99be8198e5795ca4be54719dab3d1be3c6299 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/DikeAssessmentSectionTest.cs (.../DikeAssessmentSectionTest.cs) (revision 6fc99be8198e5795ca4be54719dab3d1be3c6299) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/DikeAssessmentSectionTest.cs (.../DikeAssessmentSectionTest.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -3,7 +3,7 @@ using Core.Common.Base; using NUnit.Framework; - +using Ringtoets.Integration.Data.Contribution; using Ringtoets.Piping.Data; namespace Ringtoets.Integration.Data.Test Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/DuneAssessmentSectionTest.cs =================================================================== diff -u -r6fc99be8198e5795ca4be54719dab3d1be3c6299 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/DuneAssessmentSectionTest.cs (.../DuneAssessmentSectionTest.cs) (revision 6fc99be8198e5795ca4be54719dab3d1be3c6299) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/DuneAssessmentSectionTest.cs (.../DuneAssessmentSectionTest.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -18,7 +18,7 @@ // Assert Assert.IsInstanceOf(section); Assert.IsInstanceOf(section); - Assert.IsInstanceOf(section.FailureMechanismContribution); + Assert.IsNull(section.FailureMechanismContribution); Assert.AreEqual("Duintraject", section.Name); Assert.AreEqual("Referentielijn", section.ReferenceLine.Name); Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Placeholders/FailureMechanismPlaceholderTest.cs =================================================================== diff -u -rbe35a7226351969e98f08dec755809139ce5f081 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Placeholders/FailureMechanismPlaceholderTest.cs (.../FailureMechanismPlaceholderTest.cs) (revision be35a7226351969e98f08dec755809139ce5f081) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Placeholders/FailureMechanismPlaceholderTest.cs (.../FailureMechanismPlaceholderTest.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -1,4 +1,5 @@ -using NUnit.Framework; +using System; +using NUnit.Framework; using Ringtoets.Integration.Data.Placeholders; Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Ringtoets.Integration.Data.Test.csproj =================================================================== diff -u -r7a8e3d1718cb12c53c2b0573b056037ed02e9913 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Ringtoets.Integration.Data.Test.csproj (.../Ringtoets.Integration.Data.Test.csproj) (revision 7a8e3d1718cb12c53c2b0573b056037ed02e9913) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Ringtoets.Integration.Data.Test.csproj (.../Ringtoets.Integration.Data.Test.csproj) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -44,13 +44,19 @@ ..\..\..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll True + + ..\..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll + + + + Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/packages.config =================================================================== diff -u -r3aa69a0ff858d591479a1b33ef1ad36ae76a5052 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/packages.config (.../packages.config) (revision 3aa69a0ff858d591479a1b33ef1ad36ae76a5052) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/packages.config (.../packages.config) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -2,4 +2,5 @@ + \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/NodePresenters/AssessmentSectionBaseNodePresenterTest.cs =================================================================== diff -u -rd6e6eadf4a2521df75b6d371bacbb181a43058a3 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/NodePresenters/AssessmentSectionBaseNodePresenterTest.cs (.../AssessmentSectionBaseNodePresenterTest.cs) (revision d6e6eadf4a2521df75b6d371bacbb181a43058a3) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/NodePresenters/AssessmentSectionBaseNodePresenterTest.cs (.../AssessmentSectionBaseNodePresenterTest.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -74,16 +74,14 @@ var mocks = new MockRepository(); var projectNode = mocks.Stub(); + var assessmentSection = mocks.Stub(); var contextMenuBuilderProviderMock = mockRepository.StrictMock(); mocks.ReplayAll(); var nodePresenter = new AssessmentSectionBaseNodePresenter(contextMenuBuilderProviderMock); - var assessmentSection = new DikeAssessmentSection - { - Name = projectName - }; + assessmentSection.Name = projectName; // Call nodePresenter.UpdateNode(null, projectNode, assessmentSection); @@ -95,7 +93,7 @@ } [Test] - public void GetChildNodeObjects_DataIsDikeAssessmentSection_ReturnDikeInputsAndFailureMechanisms() + public void GetChildNodeObjects_DataIsAssessmentSectionBase_ReturnDikeInputsAndFailureMechanisms() { // Setup var mocks = new MockRepository(); @@ -176,6 +174,7 @@ // Setup var mocks = new MockRepository(); var assessmentSectionObserver = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var contextMenuBuilderProviderMock = mockRepository.StrictMock(); assessmentSectionObserver.Expect(o => o.UpdateObserver()); @@ -184,7 +183,6 @@ var nodePresenter = new AssessmentSectionBaseNodePresenter(contextMenuBuilderProviderMock); - var assessmentSection = new DikeAssessmentSection(); assessmentSection.Attach(assessmentSectionObserver); // Call @@ -220,7 +218,7 @@ { // Setup var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); + var dataMock = mocks.StrictMock(); var contextMenuBuilderProviderMock = mockRepository.StrictMock(); mocks.ReplayAll(); @@ -240,7 +238,7 @@ { // Setup var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); + var dataMock = mocks.StrictMock(); var sourceMock = mocks.StrictMock(); var targetMock = mocks.StrictMock(); var contextMenuBuilderProviderMock = mockRepository.StrictMock(); @@ -262,7 +260,7 @@ { // Setup var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); + var dataMock = mocks.StrictMock(); var sourceMock = mocks.StrictMock(); var targetMock = mocks.StrictMock(); var contextMenuBuilderProviderMock = mockRepository.StrictMock(); @@ -286,7 +284,7 @@ var mocks = new MockRepository(); var dataMock = mocks.StrictMock(); var dataMockOwner = mocks.StrictMock(); - var targetMock = mocks.StrictMock(); + var targetMock = mocks.StrictMock(); var contextMenuBuilderProviderMock = mockRepository.StrictMock(); mocks.ReplayAll(); @@ -305,7 +303,7 @@ { // Setup var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); + var dataMock = mocks.StrictMock(); var contextMenuBuilderProviderMock = mockRepository.StrictMock(); mocks.ReplayAll(); @@ -324,7 +322,7 @@ { // Setup var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); + var dataMock = mocks.StrictMock(); var eventArgsMock = mocks.StrictMock(); var contextMenuBuilderProviderMock = mockRepository.StrictMock(); @@ -344,7 +342,7 @@ { // Setup var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); + var dataMock = mocks.StrictMock(); var nodeMock = mocks.StrictMock(); var contextMenuBuilderProviderMock = mockRepository.StrictMock(); @@ -366,14 +364,13 @@ // Setup var mocks = new MockRepository(); var observerMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var contextMenuBuilderProviderMock = mockRepository.StrictMock(); observerMock.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); - var assessmentSection = new DikeAssessmentSection(); - var project = new Project(); project.Items.Add(assessmentSection); project.Attach(observerMock); @@ -394,7 +391,7 @@ { // Setup var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); + var dataMock = mocks.StrictMock(); var nodeMock = mocks.StrictMock(); var eventArgsMock = mocks.StrictMock(""); var contextMenuBuilderProviderMock = mockRepository.StrictMock(); @@ -417,6 +414,7 @@ var mocks = new MockRepository(); var contextMenuBuilderProviderMock = mocks.StrictMock(); var menuBuilderMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var nodeMock = mocks.StrictMock(); menuBuilderMock.Expect(mb => mb.AddDeleteItem()).Return(menuBuilderMock); @@ -437,7 +435,7 @@ var nodePresenter = new AssessmentSectionBaseNodePresenter(contextMenuBuilderProviderMock); // Call - nodePresenter.GetContextMenu(nodeMock, new DikeAssessmentSection()); + nodePresenter.GetContextMenu(nodeMock, assessmentSection); // Assert mocks.VerifyAll(); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismContributionViewTest.cs =================================================================== diff -u -r9f57710e6e75471cc3d44e55e514c48909b19dc4 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismContributionViewTest.cs (.../FailureMechanismContributionViewTest.cs) (revision 9f57710e6e75471cc3d44e55e514c48909b19dc4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismContributionViewTest.cs (.../FailureMechanismContributionViewTest.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -1,10 +1,12 @@ -using System.Windows.Forms; +using System; +using System.Windows.Forms; using Core.Common.Base; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Integration.Data; +using Ringtoets.Common.Data; +using Ringtoets.Integration.Data.Contribution; using Ringtoets.Integration.Forms.Views; namespace Ringtoets.Integration.Forms.Test.Views @@ -13,20 +15,25 @@ public class FailureMechanismContributionViewTest { private MockRepository mockRepository; + private FailureMechanismContribution distribution; [SetUp] public void Setup() { mockRepository = new MockRepository(); + var random = new Random(21); + var norm = random.Next(0, 200000); + var otherContribution = random.Next(0,100); + var failureMechanism = mockRepository.Stub(); + distribution = new FailureMechanismContribution(new[] { failureMechanism }, otherContribution, norm); } [Test] public void NormTextBox_Initialize_TextSetToData() { // Setup - var norm = 3000; + mockRepository.ReplayAll(); - var distribution = new FailureMechanismContribution(norm); var distributionView = new FailureMechanismContributionView { Data = distribution @@ -36,7 +43,7 @@ var result = distributionView.Controls.Find("normInput", true)[0].Text; // Assert - Assert.AreEqual(norm.ToString(), result); + Assert.AreEqual(distribution.Norm.ToString(), result); } [Test] @@ -48,9 +55,6 @@ mockRepository.ReplayAll(); - var norm = 3000; - - var distribution = new FailureMechanismContribution(norm); distribution.Attach(observerMock); var distributionView = new FailureMechanismContributionView { @@ -69,9 +73,6 @@ mockRepository.ReplayAll(); - var norm = 3000; - - var distribution = new FailureMechanismContribution(norm); distribution.Attach(observerMock); var distributionView = new FailureMechanismContributionView { @@ -85,7 +86,7 @@ var normTester = new ControlTester("normInput"); // Precondition - Assert.AreEqual(norm.ToString(), normTester.Text); + Assert.AreEqual(distribution.Norm.ToString(), normTester.Text); // Call normTester.Properties.Text = 200.ToString(); Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs =================================================================== diff -u -r6bcbd610ececdc293a8883b50448f369e1fa4a25 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs (.../PipingFailureMechanism.cs) (revision 6bcbd610ececdc293a8883b50448f369e1fa4a25) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs (.../PipingFailureMechanism.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -1,19 +1,16 @@ using System.Collections.Generic; - using Core.Common.Base; - using Ringtoets.Common.Data; using Ringtoets.Common.Placeholder; using Ringtoets.Piping.Data.Properties; - using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; namespace Ringtoets.Piping.Data { /// /// Model for performing piping calculations. /// - public class PipingFailureMechanism : Observable, IFailureMechanism + public class PipingFailureMechanism : BaseFailureMechanism { /// /// Initializes a new instance of the class. @@ -28,6 +25,7 @@ pipingCalculationGroup.Children.Add(new PipingCalculation()); CalculationsGroup = pipingCalculationGroup; AssessmentResult = new OutputPlaceholder(RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName); + Name = Resources.PipingFailureMechanism_DisplayName; } /// Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/NodePresenters/PipingFailureMechanismNodePresenter.cs =================================================================== diff -u -r5600bdc79b866be64b1c51026ce5f13c1f1c9226 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/NodePresenters/PipingFailureMechanismNodePresenter.cs (.../PipingFailureMechanismNodePresenter.cs) (revision 5600bdc79b866be64b1c51026ce5f13c1f1c9226) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/NodePresenters/PipingFailureMechanismNodePresenter.cs (.../PipingFailureMechanismNodePresenter.cs) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -42,7 +42,7 @@ protected override void UpdateNode(ITreeNode parentNode, ITreeNode node, PipingFailureMechanism nodeData) { - node.Text = PipingDataResources.PipingFailureMechanism_DisplayName; + node.Text = nodeData.Name; node.Image = PipingFormsResources.PipingIcon; node.ForegroundColor = Color.FromKnownColor(KnownColor.ControlText); } Index: packages/repositories.config =================================================================== diff -u -r9f57710e6e75471cc3d44e55e514c48909b19dc4 -r75aa4fefacf584d5172dc3bdffd348b0aacb05a4 --- packages/repositories.config (.../repositories.config) (revision 9f57710e6e75471cc3d44e55e514c48909b19dc4) +++ packages/repositories.config (.../repositories.config) (revision 75aa4fefacf584d5172dc3bdffd348b0aacb05a4) @@ -12,10 +12,13 @@ + + + @@ -33,6 +36,7 @@ +