Index: Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs (.../GuiCommandHandler.cs) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs (.../GuiCommandHandler.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -46,13 +46,13 @@ { if (!TryCloseProject()) { - Log.Warn(Resources.Opening_new_Ringtoets_project_cancelled); + Log.Warn(Resources.Opening_new_project_cancelled); return; } - Log.Info(Resources.Opening_new_Ringtoets_project); + Log.Info(Resources.Opening_new_project); gui.Application.CreateNewProject(); - Log.Info(Resources.New_Ringtoets_project_successfully_opened); + Log.Info(Resources.New_project_successfully_opened); RefreshGui(); } @@ -68,11 +68,11 @@ if (openFileDialog.ShowDialog() == DialogResult.Cancel) { - Log.Warn(Resources.Opening_existing_Ringtoets_project_cancelled); + Log.Warn(Resources.Opening_existing_project_cancelled); return false; } - Log.Info(Resources.Opening_existing_Ringtoets_project); + Log.Info(Resources.Opening_existing_project); return TryOpenExistingProject(openFileDialog.FileName); } @@ -81,13 +81,13 @@ { if (!TryCloseProject()) { - Log.Warn(Resources.Opening_existing_Ringtoets_project_cancelled); + Log.Warn(Resources.Opening_existing_project_cancelled); return false; } var result = false; - ProgressBarDialog.PerformTask(Resources.Loading_Ringtoets_project_from_selected_file, () => result = gui.Application.OpenProject(filePath)); + ProgressBarDialog.PerformTask(Resources.Loading_project_from_selected_file, () => result = gui.Application.OpenProject(filePath)); RefreshGui(); Index: Core/Common/src/Core.Common.Gui/IGuiCommandHandler.cs =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Core/Common/src/Core.Common.Gui/IGuiCommandHandler.cs (.../IGuiCommandHandler.cs) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Core/Common/src/Core.Common.Gui/IGuiCommandHandler.cs (.../IGuiCommandHandler.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -10,15 +10,15 @@ public interface IGuiCommandHandler : IDisposable { /// - /// Tries to create a new Ringtoets project. + /// Tries to create a new project. /// /// /// The creation action might be cancelled (due to user interaction). /// void TryCreateNewProject(); /// - /// Tries to open an existing Ringtoets project. + /// Tries to open an existing project. /// /// /// The opening action might be cancelled (due to user interaction). @@ -27,17 +27,17 @@ bool TryOpenExistingProject(); /// - /// Tries to open an existing Ringtoets project from file. + /// Tries to open an existing project from file. /// - /// The path to the existing Ringtoets project file. + /// The path to the existing project file. /// /// The opening action might be cancelled (due to user interaction). /// /// Whether or not an existing project was correctly opened. bool TryOpenExistingProject(string filePath); /// - /// Tries to close a Ringtoets project. + /// Tries to close a project. /// /// /// The closing action might be cancelled (due to user interaction). Index: Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs =================================================================== diff -u -r5c6efff7898381b19025262256fca49528e03e3b -r433c616fe5bea47bcc0645eb61991623530e337e --- Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5c6efff7898381b19025262256fca49528e03e3b) +++ Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34209 +// Runtime Version:4.0.30319.18063 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -1275,11 +1275,11 @@ } /// - /// Looks up a localized string similar to Loading Ringtoets project from selected file.. + /// Looks up a localized string similar to Loading project from selected file.. /// - public static string Loading_Ringtoets_project_from_selected_file { + public static string Loading_project_from_selected_file { get { - return ResourceManager.GetString("Loading_Ringtoets_project_from_selected_file", resourceCulture); + return ResourceManager.GetString("Loading_project_from_selected_file", resourceCulture); } } @@ -1530,11 +1530,11 @@ } /// - /// Looks up a localized string similar to Nieuw Ringtoets project succesvol geopend.. + /// Looks up a localized string similar to Nieuw project succesvol geopend.. /// - public static string New_Ringtoets_project_successfully_opened { + public static string New_project_successfully_opened { get { - return ResourceManager.GetString("New_Ringtoets_project_successfully_opened", resourceCulture); + return ResourceManager.GetString("New_project_successfully_opened", resourceCulture); } } @@ -1569,38 +1569,38 @@ } /// - /// Looks up a localized string similar to Openen van bestaand Ringtoets project.. + /// Looks up a localized string similar to Openen van bestaand project.. /// - public static string Opening_existing_Ringtoets_project { + public static string Opening_existing_project { get { - return ResourceManager.GetString("Opening_existing_Ringtoets_project", resourceCulture); + return ResourceManager.GetString("Opening_existing_project", resourceCulture); } } /// - /// Looks up a localized string similar to Openen van bestaand Ringtoets project geannuleerd.. + /// Looks up a localized string similar to Openen van bestaand project geannuleerd.. /// - public static string Opening_existing_Ringtoets_project_cancelled { + public static string Opening_existing_project_cancelled { get { - return ResourceManager.GetString("Opening_existing_Ringtoets_project_cancelled", resourceCulture); + return ResourceManager.GetString("Opening_existing_project_cancelled", resourceCulture); } } /// - /// Looks up a localized string similar to Openen van nieuw Ringtoets project.. + /// Looks up a localized string similar to Openen van nieuw project.. /// - public static string Opening_new_Ringtoets_project { + public static string Opening_new_project { get { - return ResourceManager.GetString("Opening_new_Ringtoets_project", resourceCulture); + return ResourceManager.GetString("Opening_new_project", resourceCulture); } } /// - /// Looks up a localized string similar to Openen van nieuw Ringtoets project geannuleerd.. + /// Looks up a localized string similar to Openen van nieuw project geannuleerd.. /// - public static string Opening_new_Ringtoets_project_cancelled { + public static string Opening_new_project_cancelled { get { - return ResourceManager.GetString("Opening_new_Ringtoets_project_cancelled", resourceCulture); + return ResourceManager.GetString("Opening_new_project_cancelled", resourceCulture); } } @@ -1997,7 +1997,7 @@ } /// - /// Looks up a localized string similar to Ringtoets project files (.rtx)|*.rtx. + /// Looks up a localized string similar to project files (.rtx)|*.rtx. /// public static string Ringtoets_project_file_filter { get { Index: Core/Common/src/Core.Common.Gui/Properties/Resources.resx =================================================================== diff -u -r5c6efff7898381b19025262256fca49528e03e3b -r433c616fe5bea47bcc0645eb61991623530e337e --- Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision 5c6efff7898381b19025262256fca49528e03e3b) +++ Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -145,7 +145,7 @@ ..\Resources\RelationshipsHS.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - + Openen van nieuw Ringtoets project geannuleerd. @@ -359,7 +359,7 @@ Activiteit '{0}' is niet gevonden in het project! Typefout of bent u misschien vergeten om een project te laden? - + Openen van bestaand Ringtoets project geannuleerd. @@ -401,7 +401,7 @@ Geen weergave geregistreerd voor: {0} - + Loading Ringtoets project from selected file. @@ -479,8 +479,8 @@ Berichten - - Nieuw Ringtoets project succesvol geopend. + + Nieuw project succesvol geopend. Significante cijfers: @@ -644,7 +644,7 @@ Inhoud van de grafiek weergeven (Shift + Alt + C) - + Openen van nieuw Ringtoets project. @@ -737,7 +737,7 @@ Eigenschappen - + Openen van bestaand Ringtoets project. Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapView.cs =================================================================== diff -u -ree0b95b2a1a34d8e81a21c8d05ef1354169af50c -r433c616fe5bea47bcc0645eb61991623530e337e --- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapView.cs (.../MapView.cs) (revision ee0b95b2a1a34d8e81a21c8d05ef1354169af50c) +++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapView.cs (.../MapView.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -55,7 +55,7 @@ // hide for now IsTabControlVisible = false; - // add some tools here, to avoid references to Ringtoets projects in SharpMap + // add some tools here, to avoid references to AssessmentSections in SharpMap MapControl.Tools.Add(new ExportMapToImageMapTool()); Map = new Map(MapControl.ClientSize) { Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/AssessmentSection.cs =================================================================== diff -u --- Ringtoets/Piping/src/Ringtoets.Piping.Data/AssessmentSection.cs (revision 0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/AssessmentSection.cs (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -0,0 +1,78 @@ +using System.Collections.Generic; +using Core.Common.Base; + +namespace Ringtoets.Piping.Data +{ + /// + /// Container for all the data that has been imported and calculated by the user when performing an assessment. + /// + public class AssessmentSection : IObservable + { + private readonly IList observers = new List(); + + /// + /// Creates a new instance of with a default name set. + /// + public AssessmentSection() + { + Name = "Toetstraject"; + } + + /// + /// Gets or sets the . + /// + public PipingFailureMechanism PipingFailureMechanism { get; private set; } + + /// + /// The name of the . + /// + public string Name { get; set; } + + /// + /// Removes the assigned to the . + /// + public void ClearPipingFailureMechanism() + { + PipingFailureMechanism = null; + } + + /// + /// Creates a new and assign it to the . + /// + public void InitializePipingFailureMechanism() + { + PipingFailureMechanism = new PipingFailureMechanism(); + } + + /// + /// Determines whether a new can be added to the . + /// + /// True if a new can be assigned. False otherwise. + public bool CanAddPipingFailureMechanism() + { + return PipingFailureMechanism == null; + } + + #region IObservable + + public void Attach(IObserver observer) + { + observers.Add(observer); + } + + public void Detach(IObserver observer) + { + observers.Remove(observer); + } + + public void NotifyObservers() + { + foreach (var observer in observers) + { + observer.UpdateObserver(); + } + } + + #endregion + } +} \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj =================================================================== diff -u -r02d4fb099ae6e6c228220838181eaa0f06d1d06f -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 02d4fb099ae6e6c228220838181eaa0f06d1d06f) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -77,7 +77,7 @@ Resources.resx - + Fisheye: Tag 433c616fe5bea47bcc0645eb61991623530e337e refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsProject.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/NodePresenters/AssessmentSectionNodePresenter.cs =================================================================== diff -u --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/NodePresenters/AssessmentSectionNodePresenter.cs (revision 0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/NodePresenters/AssessmentSectionNodePresenter.cs (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -0,0 +1,138 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using Core.Common.Base; +using Core.Common.Controls; +using Core.Common.Utils.Collections; +using Ringtoets.Piping.Data; +using Ringtoets.Piping.Forms.Extensions; +using Ringtoets.Piping.Forms.Properties; + +namespace Ringtoets.Piping.Forms.NodePresenters +{ + /// + /// Node presenter for items in the tree view. + /// + public class AssessmentSectionNodePresenter : ITreeNodePresenter + { + public ITreeView TreeView { get; set; } + + public Type NodeTagType + { + get + { + return typeof(AssessmentSection); + } + } + + public void UpdateNode(ITreeNode parentNode, ITreeNode node, object nodeData) + { + var assessmentSection = (AssessmentSection) nodeData; + node.Text = assessmentSection.Name; + node.Image = Resources.AssessmentSectionFolderIcon; + } + + public IEnumerable GetChildNodeObjects(object parentNodeData, ITreeNode node) + { + var assessmentSection = (AssessmentSection) parentNodeData; + if (assessmentSection.PipingFailureMechanism != null) + { + yield return assessmentSection.PipingFailureMechanism; + } + } + + public bool CanRenameNode(ITreeNode node) + { + return true; + } + + public bool CanRenameNodeTo(ITreeNode node, string newName) + { + return true; + } + + public void OnNodeRenamed(object nodeData, string newName) + { + var assessmentSection = (AssessmentSection) nodeData; + + assessmentSection.Name = newName; + assessmentSection.NotifyObservers(); + } + + public void OnNodeChecked(ITreeNode node) {} + + public DragOperations CanDrag(object nodeData) + { + return DragOperations.None; + } + + public DragOperations CanDrop(object item, ITreeNode sourceNode, ITreeNode targetNode, DragOperations validOperations) + { + return DragOperations.None; + } + + public bool CanInsert(object item, ITreeNode sourceNode, ITreeNode targetNode) + { + return false; + } + + public void OnDragDrop(object item, object sourceParentNodeData, object targetParentNodeData, DragOperations operation, int position) {} + + public void OnNodeSelected(object nodeData) {} + + public ContextMenuStrip GetContextMenu(ITreeNode sender, object nodeData) + { + var assessmentSection = (AssessmentSection) nodeData; + + var contextMenu = new ContextMenuStrip(); + if (assessmentSection.CanAddPipingFailureMechanism()) + { + contextMenu.AddMenuItem(Resources.AssessmentSectionNodePresenter_ContextMenu_Add_PipingFailureMechanism, + Resources.AssessmentSectionNodePresenter_ContextMenu_Add_PipingFailureMechanism_Tooltip, + Resources.PipingIcon, + InitializePipingFailureMechanismForAssessmentSection).Tag = nodeData; + } + else + { + contextMenu.AddMenuItem(Resources.AssessmentSectionNodePresenter_ContextMenu_Add_PipingFailureMechanism, + Resources.AssessmentSectionNodePresenter_ContextMenu_PipingFailureMechanism_Already_Added_Tooltip, + Resources.PipingIcon, + InitializePipingFailureMechanismForAssessmentSection).Enabled = false; + } + + return contextMenu; + } + + public void OnPropertyChanged(object sender, ITreeNode node, PropertyChangedEventArgs e) {} + + public void OnCollectionChanged(object sender, NotifyCollectionChangingEventArgs e) {} + + public bool CanRemove(object parentNodeData, object nodeData) + { + return true; + } + + public bool RemoveNodeData(object parentNodeData, object nodeData) + { + var parentProject = (Project) parentNodeData; + var assessmentSection = (AssessmentSection) nodeData; + + parentProject.Items.Remove(assessmentSection); + parentProject.NotifyObservers(); + + return true; + } + + private void InitializePipingFailureMechanismForAssessmentSection(object sender, EventArgs e) + { + var treeNode = (ToolStripItem) sender; + if (treeNode != null) + { + var assessmentSection = (AssessmentSection) treeNode.Tag; + assessmentSection.InitializePipingFailureMechanism(); + assessmentSection.NotifyObservers(); + } + } + } +} \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/NodePresenters/PipingFailureMechanismNodePresenter.cs =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/NodePresenters/PipingFailureMechanismNodePresenter.cs (.../PipingFailureMechanismNodePresenter.cs) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/NodePresenters/PipingFailureMechanismNodePresenter.cs (.../PipingFailureMechanismNodePresenter.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -101,10 +101,10 @@ protected override bool RemoveNodeData(object parentNodeData, PipingFailureMechanism nodeData) { - var ringtoetsProject = (RingtoetsProject)parentNodeData; + var assessmentSection = (AssessmentSection)parentNodeData; - ringtoetsProject.ClearPipingFailureMechanism(); - ringtoetsProject.NotifyObservers(); + assessmentSection.ClearPipingFailureMechanism(); + assessmentSection.NotifyObservers(); return true; } Fisheye: Tag 433c616fe5bea47bcc0645eb61991623530e337e refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Forms/NodePresenters/RingtoetsProjectNodePresenter.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r34d1317505d1a648610eca9deb3b871f88063841 -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 34d1317505d1a648610eca9deb3b871f88063841) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34209 +// Runtime Version:4.0.30319.18063 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -61,6 +61,80 @@ } /// + /// Looks up a localized string similar to Naam van het toetstraject.. + /// + public static string AssessmentSection_Name_Description { + get { + return ResourceManager.GetString("AssessmentSection_Name_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Naam. + /// + public static string AssessmentSection_Name_DisplayName { + get { + return ResourceManager.GetString("AssessmentSection_Name_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap AssessmentSectionFolderIcon { + get { + object obj = ResourceManager.GetObject("AssessmentSectionFolderIcon", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized string similar to Voeg piping faalmechanisme toe. + /// + public static string AssessmentSectionNodePresenter_ContextMenu_Add_PipingFailureMechanism { + get { + return ResourceManager.GetString("AssessmentSectionNodePresenter_ContextMenu_Add_PipingFailureMechanism", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Start een nieuwe piping toetsing voor dit project.. + /// + public static string AssessmentSectionNodePresenter_ContextMenu_Add_PipingFailureMechanism_Tooltip { + get { + return ResourceManager.GetString("AssessmentSectionNodePresenter_ContextMenu_Add_PipingFailureMechanism_Tooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Kan geen nieuwe piping toetsing starten, omdat er al een piping toetsing is gestart voor dit project.. + /// + public static string AssessmentSectionNodePresenter_ContextMenu_PipingFailureMechanism_Already_Added_Tooltip { + get { + return ResourceManager.GetString("AssessmentSectionNodePresenter_ContextMenu_PipingFailureMechanism_Already_Added_T" + + "ooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Algemeen. + /// + public static string AssessmentSectionProperties_Category { + get { + return ResourceManager.GetString("AssessmentSectionProperties_Category", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Toetstraject. + /// + public static string AssessmentSectionProperties_DisplayName { + get { + return ResourceManager.GetString("AssessmentSectionProperties_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Berekenen. /// public static string Calculate { @@ -1096,80 +1170,6 @@ } /// - /// Looks up a localized string similar to Naam van het Ringtoets project.. - /// - public static string RingtoetsProject_Name_Description { - get { - return ResourceManager.GetString("RingtoetsProject_Name_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Naam. - /// - public static string RingtoetsProject_Name_DisplayName { - get { - return ResourceManager.GetString("RingtoetsProject_Name_DisplayName", resourceCulture); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap RingtoetsProjectFolderIcon { - get { - object obj = ResourceManager.GetObject("RingtoetsProjectFolderIcon", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized string similar to Voeg piping faalmechanisme toe. - /// - public static string RingtoetsProjectNodePresenter_ContextMenu_Add_PipingFailureMechanism { - get { - return ResourceManager.GetString("RingtoetsProjectNodePresenter_ContextMenu_Add_PipingFailureMechanism", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Start een nieuwe piping toetsing voor dit project.. - /// - public static string RingtoetsProjectNodePresenter_ContextMenu_Add_PipingFailureMechanism_Tooltip { - get { - return ResourceManager.GetString("RingtoetsProjectNodePresenter_ContextMenu_Add_PipingFailureMechanism_Tooltip", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Kan geen nieuwe piping toetsing starten, omdat er al een piping toetsing is gestart voor dit project.. - /// - public static string RingtoetsProjectNodePresenter_ContextMenu_PipingFailureMechanism_Already_Added_Tooltip { - get { - return ResourceManager.GetString("RingtoetsProjectNodePresenter_ContextMenu_PipingFailureMechanism_Already_Added_To" + - "oltip", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Algemeen. - /// - public static string RingtoetsProjectProperties_Category { - get { - return ResourceManager.GetString("RingtoetsProjectProperties_Category", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Ringtoest project. - /// - public static string RingtoetsProjectProperties_DisplayName { - get { - return ResourceManager.GetString("RingtoetsProjectProperties_DisplayName", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Verschoven lognormale verdeling. /// public static string ShiftedLognormalDistribution_DisplayName { Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx =================================================================== diff -u -r34d1317505d1a648610eca9deb3b871f88063841 -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision 34d1317505d1a648610eca9deb3b871f88063841) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -307,25 +307,25 @@ Dwarsdoorsneden - + ..\Resources\folder-stand.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - Naam van het Ringtoets project. + + Naam van het toetstraject. - + Naam - - Ringtoest project + + Toetstraject Faalmechanisme piping ..\Resources\u48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - + Voeg piping faalmechanisme toe @@ -340,10 +340,10 @@ Importeer nieuwe dwarsdoorsnedes van een *.csv bestand. - + Start een nieuwe piping toetsing voor dit project. - + Kan geen nieuwe piping toetsing starten, omdat er al een piping toetsing is gestart voor dit project. @@ -490,7 +490,7 @@ Verschoven lognormaal - + Algemeen \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/AssessmentSectionProperties.cs =================================================================== diff -u --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/AssessmentSectionProperties.cs (revision 0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/AssessmentSectionProperties.cs (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -0,0 +1,31 @@ +using Core.Common.Gui; +using Core.Common.Utils; +using Ringtoets.Piping.Data; + +using Ringtoets.Piping.Forms.Properties; + +namespace Ringtoets.Piping.Forms.PropertyClasses +{ + /// + /// ViewModel of for properties panel. + /// + [ResourcesDisplayName(typeof(Resources), "AssessmentSectionProperties_DisplayName")] + public class AssessmentSectionProperties : ObjectProperties + { + [ResourcesCategory(typeof(Resources), "Categories_General")] + [ResourcesDisplayName(typeof(Resources), "AssessmentSection_Name_DisplayName")] + [ResourcesDescription(typeof(Resources), "AssessmentSection_Name_Description")] + public string Name + { + get + { + return data.Name; + } + set + { + data.Name = value; + data.NotifyObservers(); + } + } + } +} \ No newline at end of file Fisheye: Tag 433c616fe5bea47bcc0645eb61991623530e337e refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/RingtoetsProjectProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj =================================================================== diff -u -r02d4fb099ae6e6c228220838181eaa0f06d1d06f -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 02d4fb099ae6e6c228220838181eaa0f06d1d06f) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -61,7 +61,7 @@ - + @@ -73,7 +73,7 @@ - + Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSoilProfilesImporter.cs =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSoilProfilesImporter.cs (.../PipingSoilProfilesImporter.cs) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSoilProfilesImporter.cs (.../PipingSoilProfilesImporter.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -31,7 +31,7 @@ { get { - return RingtoetsFormsResources.RingtoetsProjectProperties_Category; + return RingtoetsFormsResources.AssessmentSectionProperties_Category; } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -41,7 +41,7 @@ { get { - return RingtoetsFormsResources.RingtoetsProjectProperties_Category; + return RingtoetsFormsResources.AssessmentSectionProperties_Category; } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/RingtoetsApplicationPlugin.cs =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/RingtoetsApplicationPlugin.cs (.../RingtoetsApplicationPlugin.cs) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/RingtoetsApplicationPlugin.cs (.../RingtoetsApplicationPlugin.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -12,12 +12,12 @@ { public override IEnumerable GetDataItemInfos() { - yield return new DataItemInfo + yield return new DataItemInfo { - Name = RingtoetsFormsResources.RingtoetsProjectProperties_DisplayName, - Category = RingtoetsFormsResources.RingtoetsProjectProperties_Category, - Image = RingtoetsFormsResources.RingtoetsProjectFolderIcon, - CreateData = owner => new RingtoetsProject() + Name = RingtoetsFormsResources.AssessmentSectionProperties_DisplayName, + Category = RingtoetsFormsResources.AssessmentSectionProperties_Category, + Image = RingtoetsFormsResources.AssessmentSectionFolderIcon, + CreateData = owner => new AssessmentSection() }; } Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/RingtoetsGuiPlugin.cs =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -23,7 +23,7 @@ public override IEnumerable GetPropertyInfos() { - yield return new PropertyInfo(); + yield return new PropertyInfo(); yield return new PropertyInfo(); yield return new PropertyInfo(); yield return new PropertyInfo(); @@ -32,7 +32,7 @@ public override IEnumerable GetProjectTreeViewNodePresenters() { - yield return new RingtoetsProjectNodePresenter(); + yield return new AssessmentSectionNodePresenter(); yield return new PipingCalculationInputsNodePresenter { RunActivityAction = Gui.Application.ActivityRunner.Enqueue Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/AssessmentSectionTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/AssessmentSectionTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/AssessmentSectionTest.cs (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -0,0 +1,151 @@ +using Core.Common.Base; +using NUnit.Framework; +using Rhino.Mocks; + +namespace Ringtoets.Piping.Data.Test +{ + [TestFixture] + public class AssessmentSectionTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // Call + var assessmentSection = new AssessmentSection(); + + // Assert + Assert.IsInstanceOf(assessmentSection); + Assert.AreEqual("Toetstraject", assessmentSection.Name); + } + + [Test] + public void InitializePipingFailureMechanism_WithoutFailureMechanismSet_SetNewFailureMechanism() + { + // Setup + var assessmentSection = new AssessmentSection(); + + // Call + assessmentSection.InitializePipingFailureMechanism(); + + // Assert + Assert.IsNotNull(assessmentSection.PipingFailureMechanism); + } + + [Test] + public void InitializePipingFailureMechanism_WithFailureMechanismSet_SetNewFailureMechanism() + { + // Setup + var assessmentSection = new AssessmentSection(); + assessmentSection.InitializePipingFailureMechanism(); + PipingFailureMechanism notExpectedFailureMechanism = assessmentSection.PipingFailureMechanism; + + // Precondition + Assert.IsNotNull(notExpectedFailureMechanism); + + // Call + assessmentSection.InitializePipingFailureMechanism(); + + // Assert + Assert.AreNotSame(notExpectedFailureMechanism, assessmentSection.PipingFailureMechanism); + } + + [Test] + public void ClearPipingFailureMechanism_WithFailureMechanismSet_FailureMechanismUnassigned() + { + // Setup + var assessmentSection = new AssessmentSection(); + assessmentSection.InitializePipingFailureMechanism(); + PipingFailureMechanism notExpectedFailureMechanism = assessmentSection.PipingFailureMechanism; + + // Precondition + Assert.IsNotNull(notExpectedFailureMechanism); + + // Call + assessmentSection.ClearPipingFailureMechanism(); + + // Assert + Assert.IsNull(assessmentSection.PipingFailureMechanism); + } + + [Test] + public void ClearPipingFailureMechanism_WithoutFailureMechanismSet_PipingFailureMechanismStillUnassigned() + { + // Setup + var assessmentSection = new AssessmentSection(); + + // Precondition + Assert.IsNull(assessmentSection.PipingFailureMechanism); + + // Call + assessmentSection.ClearPipingFailureMechanism(); + + // Assert + Assert.IsNull(assessmentSection.PipingFailureMechanism); + } + + [Test] + public void NotifyObservers_ObserverAttachedToProject_ObserverIsNotified() + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + var assessmentSection = new AssessmentSection(); + assessmentSection.Attach(observer); + + // Call + assessmentSection.NotifyObservers(); + + // Assert + mocks.VerifyAll(); + } + + [Test] + public void NotifyObservers_ObserverHasBeenDetached_ObserverShouldNotBeNotified() + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + mocks.ReplayAll(); + + var assessmentSection = new AssessmentSection(); + assessmentSection.Attach(observer); + assessmentSection.Detach(observer); + + // Call + assessmentSection.NotifyObservers(); + + // Assert + mocks.VerifyAll(); // Expect no calls on observer + } + + [Test] + public void CanAddPipingFailureMechanism_NoPipingFailureMechanismAssigned_ReturnsTrue() + { + // Setup + var assessmentSection = new AssessmentSection(); + + // Call + var result = assessmentSection.CanAddPipingFailureMechanism(); + + // Assert + Assert.IsTrue(result); + } + + [Test] + public void CanAddPipingFailureMechanism_PipingFailureMechanismInitialized_ReturnsTrue() + { + // Setup + var assessmentSection = new AssessmentSection(); + assessmentSection.InitializePipingFailureMechanism(); + + // Call + var result = assessmentSection.CanAddPipingFailureMechanism(); + + // Assert + Assert.IsFalse(result); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -66,7 +66,7 @@ - + Fisheye: Tag 433c616fe5bea47bcc0645eb61991623530e337e refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsProjectTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/NodePresenters/AssessmentSectionNodePresenterTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/NodePresenters/AssessmentSectionNodePresenterTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/NodePresenters/AssessmentSectionNodePresenterTest.cs (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -0,0 +1,433 @@ +using System.ComponentModel; +using System.Linq; +using Core.Common.Controls; +using Core.Common.Utils.Collections; +using System.Windows.Forms; +using Core.Common.Base; +using NUnit.Framework; +using Rhino.Mocks; + +using Ringtoets.Piping.Data; + +using Ringtoets.Piping.Forms.NodePresenters; +using RingtoetsFormsResources = Ringtoets.Piping.Forms.Properties.Resources; + +namespace Ringtoets.Piping.Forms.Test.NodePresenters +{ + [TestFixture] + public class AssessmentSectionNodePresenterTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // Call + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Assert + Assert.IsInstanceOf(nodePresenter); + Assert.IsNull(nodePresenter.TreeView); + Assert.AreEqual(typeof(AssessmentSection), nodePresenter.NodeTagType); + } + + [Test] + public void UpdateNode_WithData_InitializeNode() + { + // Setup + const string projectName = ""; + + var mocks = new MockRepository(); + var projectNode = mocks.Stub(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + var assessmentSection = new AssessmentSection + { + Name = projectName + }; + + // Call + nodePresenter.UpdateNode(null, projectNode, assessmentSection); + + // Assert + Assert.AreEqual(projectName, projectNode.Text); + Assert.AreEqual(16, projectNode.Image.Height); + Assert.AreEqual(16, projectNode.Image.Width); + } + + [Test] + public void GetChildNodeObjects_WithoutPipingFailureMechanism_ReturnsEmptyList() + { + // Setup + var mocks = new MockRepository(); + var nodeMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + var assessmentSection = new AssessmentSection(); + + // Call + var children = nodePresenter.GetChildNodeObjects(assessmentSection, nodeMock); + + // Assert + CollectionAssert.IsEmpty(children); + mocks.VerifyAll(); // Expect no calls on tree node + } + + [Test] + public void GetChildNodeObjects_WithPipingFailureMechanism_ReturnPipingFailureMechanism() + { + // Setup + var mocks = new MockRepository(); + var nodeMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + var assessmentSection = new AssessmentSection(); + assessmentSection.InitializePipingFailureMechanism(); + + // Call + var children = nodePresenter.GetChildNodeObjects(assessmentSection, nodeMock).Cast().AsList(); + + // Assert + Assert.AreEqual(1, children.Count); + Assert.AreSame(assessmentSection.PipingFailureMechanism, children[0]); + mocks.VerifyAll(); // Expect no calls on tree node + } + + [Test] + public void CanRenameNode_Always_ReturnTrue() + { + // Setup + var mocks = new MockRepository(); + var nodeMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + var renameAllowed = nodePresenter.CanRenameNode(nodeMock); + + // Assert + Assert.IsTrue(renameAllowed); + mocks.VerifyAll(); // Expect no calls on tree node + } + + [Test] + public void CanRenameNodeTo_Always_ReturnTrue() + { + // Setup + var mocks = new MockRepository(); + var nodeMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + var renameAllowed = nodePresenter.CanRenameNodeTo(nodeMock, ""); + + // Assert + Assert.IsTrue(renameAllowed); + mocks.ReplayAll(); // Expect no calls on tree node + } + + [Test] + public void OnNodeRenamed_WithData_SetProjectNameWithNotification() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionObserver = mocks.StrictMock(); + assessmentSectionObserver.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + var assessmentSection = new AssessmentSection(); + assessmentSection.Attach(assessmentSectionObserver); + + // Call + const string newName = "New Name"; + nodePresenter.OnNodeRenamed(assessmentSection, newName); + + // Assert + Assert.AreEqual(newName, assessmentSection.Name); + mocks.VerifyAll(); + } + + [Test] + public void OnNodeChecked_Always_DoNothing() + { + // Setup + var mocks = new MockRepository(); + var nodeMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + nodePresenter.OnNodeChecked(nodeMock); + + // Assert + mocks.VerifyAll(); // Expect no calls on tree node + } + + [Test] + public void CanDrag_Always_ReturnNone() + { + // Setup + var mocks = new MockRepository(); + var dataMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + DragOperations dragAllowed = nodePresenter.CanDrag(dataMock); + + // Assert + Assert.AreEqual(DragOperations.None, dragAllowed); + mocks.VerifyAll(); + } + + [Test] + public void CanDrop_Always_ReturnNone() + { + // Setup + var mocks = new MockRepository(); + var dataMock = mocks.StrictMock(); + var sourceMock = mocks.StrictMock(); + var targetMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + DragOperations dropAllowed = nodePresenter.CanDrop(dataMock, sourceMock, targetMock, DragOperations.Move); + + // Assert + Assert.AreEqual(DragOperations.None, dropAllowed); + mocks.VerifyAll(); // Expect no calls on mocks. + } + + [Test] + public void CanInsert_Always_ReturnFalse() + { + // Setup + var mocks = new MockRepository(); + var dataMock = mocks.StrictMock(); + var sourceMock = mocks.StrictMock(); + var targetMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + bool insertionAllowed = nodePresenter.CanInsert(dataMock, sourceMock, targetMock); + + // Assert + Assert.IsFalse(insertionAllowed); + mocks.VerifyAll(); // Expect no calls on arguments + } + + [Test] + public void OnDragDrop_Always_DoNothing() + { + // Setup + var mocks = new MockRepository(); + var dataMock = mocks.StrictMock(); + var sourceParentNodeMock = mocks.StrictMock(); + var targetParentNodeDataMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + nodePresenter.OnDragDrop(dataMock, sourceParentNodeMock, targetParentNodeDataMock, DragOperations.Move, 2); + + // Assert + mocks.VerifyAll(); // Expect no calls on arguments + } + + [Test] + public void OnNodeSelected_Always_DoNothing() + { + // Setup + var mocks = new MockRepository(); + var dataMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + nodePresenter.OnNodeSelected(dataMock); + + // Assert + mocks.VerifyAll(); // Expect no calls on arguments + } + + [Test] + public void GetContextMenu_WithNoPipingFailureMechanism_ReturnsContextMenuWithOneItemWithDataAsTag() + { + // Setup + var mocks = new MockRepository(); + var nodeMock = mocks.StrictMock(); + var assessmentSection = new AssessmentSection(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + var contextMenu = nodePresenter.GetContextMenu(nodeMock, assessmentSection); + + // Assert + Assert.IsNotNull(contextMenu); + Assert.AreEqual(1, contextMenu.Items.Count); + ToolStripItem addPipingItem = contextMenu.Items[0]; + Assert.AreEqual(RingtoetsFormsResources.AssessmentSectionNodePresenter_ContextMenu_Add_PipingFailureMechanism, addPipingItem.Text); + Assert.AreEqual(RingtoetsFormsResources.AssessmentSectionNodePresenter_ContextMenu_Add_PipingFailureMechanism_Tooltip, addPipingItem.ToolTipText); + Assert.IsTrue(addPipingItem.Enabled); + Assert.AreSame(assessmentSection, addPipingItem.Tag); + Assert.AreEqual(16, addPipingItem.Image.Height); + Assert.AreEqual(16, addPipingItem.Image.Width); + mocks.VerifyAll(); // Expect no calls on arguments + } + + [Test] + public void GetContextMenu_WithPipingFailureMechanismAlreadySet_ReturnsContextMenuWithOneDisabledItem() + { + // Setup + var mocks = new MockRepository(); + var nodeMock = mocks.StrictMock(); + var assessmentSection = new AssessmentSection(); + assessmentSection.InitializePipingFailureMechanism(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + var contextMenu = nodePresenter.GetContextMenu(nodeMock, assessmentSection); + + // Assert + Assert.IsNotNull(contextMenu); + Assert.AreEqual(1, contextMenu.Items.Count); + ToolStripItem addPipingItem = contextMenu.Items[0]; + Assert.AreEqual(RingtoetsFormsResources.AssessmentSectionNodePresenter_ContextMenu_Add_PipingFailureMechanism, addPipingItem.Text); + Assert.AreEqual(RingtoetsFormsResources.AssessmentSectionNodePresenter_ContextMenu_PipingFailureMechanism_Already_Added_Tooltip, addPipingItem.ToolTipText); + Assert.IsFalse(addPipingItem.Enabled); + Assert.IsNull(addPipingItem.Tag); + Assert.AreEqual(16, addPipingItem.Image.Height); + Assert.AreEqual(16, addPipingItem.Image.Width); + mocks.VerifyAll(); // Expect no calls on arguments + } + + [Test] + public void OnPropertyChange_Always_DoNothing() + { + // Setup + var mocks = new MockRepository(); + var dataMock = mocks.StrictMock(); + var nodeMock = mocks.StrictMock(); + var eventArgsMock = mocks.StrictMock(""); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + nodePresenter.OnPropertyChanged(dataMock, nodeMock, eventArgsMock); + + // Assert + mocks.VerifyAll(); // Expect no calls on arguments + } + + [Test] + public void OnCollectionChange_Always_DoNothing() + { + // Setup + var mocks = new MockRepository(); + var dataMock = mocks.StrictMock(); + var eventArgsMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + nodePresenter.OnCollectionChanged(dataMock, eventArgsMock); + + // Assert + mocks.VerifyAll(); // Expect no calls on arguments + } + + [Test] + public void CanRemove_Always_ReturnTrue() + { + // Setup + var mocks = new MockRepository(); + var dataMock = mocks.StrictMock(); + var nodeMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + bool removalAllowed = nodePresenter.CanRemove(dataMock, nodeMock); + + // Assert + Assert.IsTrue(removalAllowed); + mocks.VerifyAll(); // Expect no calls on arguments + } + + [Test] + public void RemoveNodeData_ProjectWithAssessmentSection_ReturnTrueAndRemoveAssessmentSection() + { + // Setup + var mocks = new MockRepository(); + + var observerMock = mocks.StrictMock(); + observerMock.Expect(o => o.UpdateObserver()); + + mocks.ReplayAll(); + + var assessmentSection = new AssessmentSection(); + + var project = new Project(); + project.Items.Add(assessmentSection); + project.Attach(observerMock); + + var nodePresenter = new AssessmentSectionNodePresenter(); + + // Call + bool removalSuccesful = nodePresenter.RemoveNodeData(project, assessmentSection); + + // Assert + Assert.IsTrue(removalSuccesful); + CollectionAssert.DoesNotContain(project.Items, assessmentSection); + mocks.VerifyAll(); + } + + [Test] + public void AssessmentSectionWithoutPipingFailureMechanism_AddPipingFailureMechanismThroughContextMenu_AssessmentSectionHasPipingFailureMechanism() + { + // Setup + var mocks = new MockRepository(); + var nodeMock = mocks.StrictMock(); + var assessmentSection = new AssessmentSection(); + mocks.ReplayAll(); + + var nodePresenter = new AssessmentSectionNodePresenter(); + var contextMenu = nodePresenter.GetContextMenu(nodeMock, assessmentSection); + + // Preconditions + Assert.IsNotNull(contextMenu); + Assert.IsNull(assessmentSection.PipingFailureMechanism); + Assert.AreEqual(1, contextMenu.Items.Count); + + // Call + contextMenu.Items[0].PerformClick(); + + // Assert + Assert.IsNotNull(assessmentSection.PipingFailureMechanism); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/NodePresenters/PipingFailureMechanismNodePresenterTest.cs =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/NodePresenters/PipingFailureMechanismNodePresenterTest.cs (.../PipingFailureMechanismNodePresenterTest.cs) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/NodePresenters/PipingFailureMechanismNodePresenterTest.cs (.../PipingFailureMechanismNodePresenterTest.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -418,7 +418,7 @@ { // Setup var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); + var dataMock = mocks.StrictMock(); var nodeMock = mocks.StrictMock(); mocks.ReplayAll(); @@ -433,20 +433,20 @@ } [Test] - public void RemoveNodeData_PipingFailureMechanism_PipingFailureMechanismRemovedFromRingtoetsProject() + public void RemoveNodeData_PipingFailureMechanism_PipingFailureMechanismRemovedFromAssessmentSection() { // Setup - var project = new RingtoetsProject(); - project.InitializePipingFailureMechanism(); + var assessmentSection = new AssessmentSection(); + assessmentSection.InitializePipingFailureMechanism(); var nodePresenter = new PipingFailureMechanismNodePresenter(); // Call - bool removalSuccesful = nodePresenter.RemoveNodeData(project, new PipingFailureMechanism()); + bool removalSuccesful = nodePresenter.RemoveNodeData(assessmentSection, new PipingFailureMechanism()); // Assert Assert.IsTrue(removalSuccesful); - Assert.IsNull(project.PipingFailureMechanism); + Assert.IsNull(assessmentSection.PipingFailureMechanism); } [Test] Fisheye: Tag 433c616fe5bea47bcc0645eb61991623530e337e refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/NodePresenters/RingtoetsProjectNodePresenterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/AssessmentSectionPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/AssessmentSectionPropertiesTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/AssessmentSectionPropertiesTest.cs (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -0,0 +1,71 @@ +using Core.Common.Base; +using Core.Common.Gui; +using NUnit.Framework; +using Rhino.Mocks; + +using Ringtoets.Piping.Data; + +using Ringtoets.Piping.Forms.PropertyClasses; + +namespace Ringtoets.Piping.Forms.Test.PropertyClasses +{ + [TestFixture] + public class AssessmentSectionPropertiesTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // Call + var properties = new AssessmentSectionProperties(); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.IsNull(properties.Data); + } + + [Test] + public void GetProperties_WithData_ReturnExpectedValues() + { + // Setup + var assessmentSection = new AssessmentSection + { + Name = "Test" + }; + + var properties = new AssessmentSectionProperties + { + Data = assessmentSection + }; + + // Call & Assert + Assert.AreEqual(assessmentSection.Name, properties.Name); + } + + [Test] + public void SetProperties_WithData_UpdateDataAndNotifyObservers() + { + // Setup + var mocks = new MockRepository(); + var projectObserver = mocks.StrictMock(); + projectObserver.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + var assessmentSection = new AssessmentSection(); + assessmentSection.Attach(projectObserver); + + var properties = new AssessmentSectionProperties + { + Data = assessmentSection + }; + + const string newName = "Test"; + + // Call + properties.Name = newName; + + // Assert + Assert.AreEqual(newName, assessmentSection.Name); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Fisheye: Tag 433c616fe5bea47bcc0645eb61991623530e337e refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/RingtoetsProjectPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -56,14 +56,14 @@ - + - + Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSoilProfilesImporterTest.cs =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSoilProfilesImporterTest.cs (.../PipingSoilProfilesImporterTest.cs) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSoilProfilesImporterTest.cs (.../PipingSoilProfilesImporterTest.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -42,7 +42,7 @@ // Assert Assert.IsInstanceOf(importer); Assert.AreEqual(RingtoetsFormsResources.PipingSoilProfilesCollection_DisplayName, importer.Name); - Assert.AreEqual(RingtoetsFormsResources.RingtoetsProjectProperties_Category, importer.Category); + Assert.AreEqual(RingtoetsFormsResources.AssessmentSectionProperties_Category, importer.Category); Assert.AreEqual(16, importer.Image.Width); Assert.AreEqual(16, importer.Image.Height); CollectionAssert.AreEqual(new[] { typeof(ICollection) }, importer.SupportedItemTypes); Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs (.../PipingSurfaceLineCsvImporterTest.cs) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs (.../PipingSurfaceLineCsvImporterTest.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -33,7 +33,7 @@ // Assert Assert.IsInstanceOf(importer); Assert.AreEqual(RingtoetsFormsResources.PipingSurfaceLinesCollection_DisplayName, importer.Name); - Assert.AreEqual(RingtoetsFormsResources.RingtoetsProjectProperties_Category, importer.Category); + Assert.AreEqual(RingtoetsFormsResources.AssessmentSectionProperties_Category, importer.Category); Assert.AreEqual(16, importer.Image.Width); Assert.AreEqual(16, importer.Image.Height); CollectionAssert.AreEqual(new[] { typeof(ICollection) }, importer.SupportedItemTypes); Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/RingtoetsApplicationPluginTest.cs =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/RingtoetsApplicationPluginTest.cs (.../RingtoetsApplicationPluginTest.cs) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/RingtoetsApplicationPluginTest.cs (.../RingtoetsApplicationPluginTest.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -33,13 +33,13 @@ // assert Assert.AreEqual(1, dataItemDefinitions.Length); - DataItemInfo projectDataItemDefinition = dataItemDefinitions.Single(did => did.ValueType == typeof(RingtoetsProject)); - Assert.AreEqual(RingtoetsFormsResources.RingtoetsProjectProperties_DisplayName, projectDataItemDefinition.Name); - Assert.AreEqual(RingtoetsFormsResources.RingtoetsProjectProperties_Category, projectDataItemDefinition.Category); + DataItemInfo projectDataItemDefinition = dataItemDefinitions.Single(did => did.ValueType == typeof(AssessmentSection)); + Assert.AreEqual(RingtoetsFormsResources.AssessmentSectionProperties_DisplayName, projectDataItemDefinition.Name); + Assert.AreEqual(RingtoetsFormsResources.AssessmentSectionProperties_Category, projectDataItemDefinition.Category); Assert.AreEqual(16, projectDataItemDefinition.Image.Width); Assert.AreEqual(16, projectDataItemDefinition.Image.Height); Assert.IsNull(projectDataItemDefinition.AdditionalOwnerCheck); - Assert.IsInstanceOf(projectDataItemDefinition.CreateData(null)); + Assert.IsInstanceOf(projectDataItemDefinition.CreateData(null)); Assert.IsNull(projectDataItemDefinition.AddExampleData); } Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/RingtoetsGuiPluginTest.cs =================================================================== diff -u -r4d688bb446eb4508ff3b54b06baefbb71f60237a -r433c616fe5bea47bcc0645eb61991623530e337e --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision 4d688bb446eb4508ff3b54b06baefbb71f60237a) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision 433c616fe5bea47bcc0645eb61991623530e337e) @@ -47,11 +47,11 @@ // assert Assert.AreEqual(5, propertyInfos.Length); - var RingtoetsProjectProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(RingtoetsProject)); - Assert.AreEqual(typeof(RingtoetsProjectProperties), RingtoetsProjectProperties.PropertyType); - Assert.IsNull(RingtoetsProjectProperties.AdditionalDataCheck); - Assert.IsNull(RingtoetsProjectProperties.GetObjectPropertiesData); - Assert.IsNull(RingtoetsProjectProperties.AfterCreate); + var assessmentSectionProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(AssessmentSection)); + Assert.AreEqual(typeof(AssessmentSectionProperties), assessmentSectionProperties.PropertyType); + Assert.IsNull(assessmentSectionProperties.AdditionalDataCheck); + Assert.IsNull(assessmentSectionProperties.GetObjectPropertiesData); + Assert.IsNull(assessmentSectionProperties.AfterCreate); var pipingDataProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(PipingCalculationInputs)); Assert.AreEqual(typeof(PipingCalculationInputsProperties), pipingDataProperties.PropertyType); @@ -100,7 +100,7 @@ // assert Assert.AreEqual(8, nodePresenters.Length); - Assert.IsTrue(nodePresenters.Any(np => np is RingtoetsProjectNodePresenter)); + Assert.IsTrue(nodePresenters.Any(np => np is AssessmentSectionNodePresenter)); Assert.IsTrue(nodePresenters.Any(np => np is PipingSurfaceLineCollectionNodePresenter)); Assert.IsTrue(nodePresenters.Any(np => np is PipingSurfaceLineNodePresenter)); Assert.IsTrue(nodePresenters.Any(np => np is PipingSoilProfileCollectionNodePresenter));