Index: src/Plugins/Wti/Wti.Calculation/Piping/PipingCalculation.cs =================================================================== diff -u -r3e905c4e56df168cc8fe333589e2d5420a600f04 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Calculation/Piping/PipingCalculation.cs (.../PipingCalculation.cs) (revision 3e905c4e56df168cc8fe333589e2d5420a600f04) +++ src/Plugins/Wti/Wti.Calculation/Piping/PipingCalculation.cs (.../PipingCalculation.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -2,6 +2,8 @@ using System.Linq; using Deltares.WTIPiping; +using Wti.Calculation.Properties; + namespace Wti.Calculation.Piping { /// @@ -51,7 +53,12 @@ /// public List Validate() { - List upliftCalculatorValidationResults = CreateUpliftCalculator().Validate(); + List upliftCalculatorValidationResults = input.SurfaceLine != null ? + CreateUpliftCalculator().Validate() : + new List(new[] + { + Resources.PipingCalculation_Validate_Lacks_surfaceline_uplift + }); List heaveCalculatorValidationResults = CreateHeaveCalculator().Validate(); List sellmeijerCalculatorValidationResults = CreateSellmeijerCalculator().Validate(); @@ -177,7 +184,7 @@ ExitPointXCoordinate = input.ExitPointXCoordinate, PhreaticLevel = input.PhreaticLevelExit, SoilProfile = PipingProfileCreator.Create(), - SurfaceLine = PipingSurfaceLineCreator.Create(), + SurfaceLine = PipingSurfaceLineCreator.Create(input.SurfaceLine), VolumicWeightOfWater = input.WaterVolumetricWeight }; calculator.Calculate(); Index: src/Plugins/Wti/Wti.Calculation/Piping/PipingCalculationInput.cs =================================================================== diff -u -r5fc71a385897af92ccb092f2f969b5709afab85a -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Calculation/Piping/PipingCalculationInput.cs (.../PipingCalculationInput.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) +++ src/Plugins/Wti/Wti.Calculation/Piping/PipingCalculationInput.cs (.../PipingCalculationInput.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -1,4 +1,6 @@ -namespace Wti.Calculation.Piping +using Wti.Data; + +namespace Wti.Calculation.Piping { /// /// This class contains all the parameters that are required to perform a piping assessment. @@ -27,6 +29,7 @@ private readonly double meanDiameter70; private readonly double beddingAngle; private readonly double exitPointXCoordinate; + private readonly RingtoetsPipingSurfaceLine surfaceLine; /// /// Constructs a new , which contains values for the parameters used @@ -54,7 +57,8 @@ /// The mean diameter of small scale tests applied to different kinds of sand, on which the formula of Sellmeijer has been fit. [m] /// The angle of the force balance representing the amount in which sand grains resist rolling. [°] /// The x coordinate of the exit point. [m] - public PipingCalculationInput(double waterVolumetricWeight, double upliftModelFactor, double assessmentLevel, double piezometricHeadExit, double dampingFactorExit, double phreaticLevelExit, double piezometricHeadPolder, double criticalHeaveGradient, double thicknessCoverageLayer, double sellmeijerModelFactor, double sellmeijerReductionFactor, double seepageLength, double sandParticlesVolumicWeight, double whitesDragCoefficient, double diameter70, double darcyPermeability, double waterKinematicViscosity, double gravity, double thicknessAquiferLayer, double meanDiameter70, double beddingAngle, double exitPointXCoordinate) + /// The surface line. + public PipingCalculationInput(double waterVolumetricWeight, double upliftModelFactor, double assessmentLevel, double piezometricHeadExit, double dampingFactorExit, double phreaticLevelExit, double piezometricHeadPolder, double criticalHeaveGradient, double thicknessCoverageLayer, double sellmeijerModelFactor, double sellmeijerReductionFactor, double seepageLength, double sandParticlesVolumicWeight, double whitesDragCoefficient, double diameter70, double darcyPermeability, double waterKinematicViscosity, double gravity, double thicknessAquiferLayer, double meanDiameter70, double beddingAngle, double exitPointXCoordinate, RingtoetsPipingSurfaceLine surfaceLine) { this.waterVolumetricWeight = waterVolumetricWeight; this.upliftModelFactor = upliftModelFactor; @@ -78,6 +82,7 @@ this.meanDiameter70 = meanDiameter70; this.beddingAngle = beddingAngle; this.exitPointXCoordinate = exitPointXCoordinate; + this.surfaceLine = surfaceLine; } #region properties @@ -340,6 +345,17 @@ } } + /// + /// Gets the surface line. + /// + public RingtoetsPipingSurfaceLine SurfaceLine + { + get + { + return surfaceLine; + } + } + #endregion } } \ No newline at end of file Index: src/Plugins/Wti/Wti.Calculation/Piping/PipingSurfaceLineCreator.cs =================================================================== diff -u -rad18963162aaa0d4f16d583f2bd8b51480e1e1ba -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Calculation/Piping/PipingSurfaceLineCreator.cs (.../PipingSurfaceLineCreator.cs) (revision ad18963162aaa0d4f16d583f2bd8b51480e1e1ba) +++ src/Plugins/Wti/Wti.Calculation/Piping/PipingSurfaceLineCreator.cs (.../PipingSurfaceLineCreator.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -1,20 +1,29 @@ +using System.Linq; + using Deltares.WTIPiping; +using Wti.Data; + namespace Wti.Calculation.Piping { /// - /// Creates instances which are required by the . + /// Creates instances which are required by the . /// internal static class PipingSurfaceLineCreator { /// - /// Creates a simple with a single at the origin. + /// Creates a for the kernel + /// given different surface line. /// - /// - public static PipingSurfaceLine Create() + /// The surface line configured in the Ringtoets application. + /// The surface line to be consumed by the kernel. + public static PipingSurfaceLine Create(RingtoetsPipingSurfaceLine line) { - var surfaceLine = new PipingSurfaceLine(); - surfaceLine.Points.Add(new PipingPoint(0, 0, 0)); + var surfaceLine = new PipingSurfaceLine + { + Name = line.Name + }; + surfaceLine.Points.AddRange(line.Points.Select(p => new PipingPoint(p.X, p.Y, p.Z))); return surfaceLine; } Index: src/Plugins/Wti/Wti.Calculation/Properties/Resources.Designer.cs =================================================================== diff -u --- src/Plugins/Wti/Wti.Calculation/Properties/Resources.Designer.cs (revision 0) +++ src/Plugins/Wti/Wti.Calculation/Properties/Resources.Designer.cs (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -0,0 +1,81 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18444 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Wti.Calculation.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Wti.Calculation.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Een dwarsdoorsnede moet geselecteerd zijn om een Uplift berekening uit te kunnen voeren.. + /// + internal static string PipingCalculation_Validate_Lacks_surfaceline_uplift { + get { + return ResourceManager.GetString("PipingCalculation_Validate_Lacks_surfaceline_uplift", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to . + /// + internal static string String1 { + get { + return ResourceManager.GetString("String1", resourceCulture); + } + } + } +} Index: src/Plugins/Wti/Wti.Calculation/Properties/Resources.resx =================================================================== diff -u --- src/Plugins/Wti/Wti.Calculation/Properties/Resources.resx (revision 0) +++ src/Plugins/Wti/Wti.Calculation/Properties/Resources.resx (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + + Een dwarsdoorsnede moet geselecteerd zijn om een Uplift berekening uit te kunnen voeren. + + \ No newline at end of file Index: src/Plugins/Wti/Wti.Calculation/Wti.Calculation.csproj =================================================================== diff -u -r2ff69dfc67c77d80c1ed2f4f1f9bc0172e28e518 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Calculation/Wti.Calculation.csproj (.../Wti.Calculation.csproj) (revision 2ff69dfc67c77d80c1ed2f4f1f9bc0172e28e518) +++ src/Plugins/Wti/Wti.Calculation/Wti.Calculation.csproj (.../Wti.Calculation.csproj) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -15,7 +15,7 @@ true bin\Debug\ - 4 + 4 DEBUG;TRACE full x86 @@ -26,7 +26,7 @@ bin\Release\ - 4 + 4 TRACE true pdbonly @@ -53,6 +53,11 @@ + + True + True + Resources.resx + @@ -66,6 +71,12 @@ Wti.Data + + + ResXFileCodeGenerator + Resources.Designer.cs + + Index: src/Plugins/Wti/Wti.Data/PipingData.cs =================================================================== diff -u -rf65154bc499025f9f5b37b9de0ebdf8026336020 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Data/PipingData.cs (.../PipingData.cs) (revision f65154bc499025f9f5b37b9de0ebdf8026336020) +++ src/Plugins/Wti/Wti.Data/PipingData.cs (.../PipingData.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -156,7 +156,7 @@ /// /// Gets or sets the surface line. /// - public PipingSurfaceLine SurfaceLine { get; set; } + public RingtoetsPipingSurfaceLine SurfaceLine { get; set; } /// /// Gets or sets , which contains the results of a Piping calculation. Index: src/Plugins/Wti/Wti.Data/PipingFailureMechanism.cs =================================================================== diff -u -rab8c3b732c3aaadc8e55be98e132bdaf41110169 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Data/PipingFailureMechanism.cs (.../PipingFailureMechanism.cs) (revision ab8c3b732c3aaadc8e55be98e132bdaf41110169) +++ src/Plugins/Wti/Wti.Data/PipingFailureMechanism.cs (.../PipingFailureMechanism.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -18,15 +18,15 @@ /// public PipingFailureMechanism() { - SurfaceLines = new ObservableList(); + SurfaceLines = new ObservableList(); SoilProfiles = Enumerable.Empty(); PipingData = new PipingData(); } /// - /// Gets the available within the scope of the piping failure mechanism. + /// Gets the available within the scope of the piping failure mechanism. /// - public IEnumerable SurfaceLines { get; private set; } + public IEnumerable SurfaceLines { get; private set; } /// /// Gets the , which contains input and output of a piping calculation. Fisheye: Tag 9260afadbd7ccee6409417730493babf258cc103 refers to a dead (removed) revision in file `src/Plugins/Wti/Wti.Data/PipingSurfaceLine.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: src/Plugins/Wti/Wti.Data/RingtoetsPipingSurfaceLine.cs =================================================================== diff -u --- src/Plugins/Wti/Wti.Data/RingtoetsPipingSurfaceLine.cs (revision 0) +++ src/Plugins/Wti/Wti.Data/RingtoetsPipingSurfaceLine.cs (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -0,0 +1,61 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wti.Data +{ + /// + /// Definition of a surfaceline for piping. + /// + public class RingtoetsPipingSurfaceLine + { + /// + /// Initializes a new instance of the class. + /// + public RingtoetsPipingSurfaceLine() + { + Name = string.Empty; + Points = Enumerable.Empty(); + } + + /// + /// Gets or sets the name of the surfaceline. + /// + public string Name { get; set; } + + /// + /// Gets or sets the 3D points describing its geometry. + /// + public IEnumerable Points { get; private set; } + + /// + /// Gets or sets the first 3D geometry point defining the surfaceline in world coordinates. + /// + public Point3D StartingWorldPoint { get; private set; } + + /// + /// Gets or sets the last 3D geometry point defining the surfaceline in world coordinates. + /// + public Point3D EndingWorldPoint { get; private set; } + + /// + /// Sets the geometry of the surfaceline. + /// + /// The collection of points defining the surfaceline geometry. + public void SetGeometry(IEnumerable points) + { + var point3Ds = points.ToArray(); + Points = point3Ds; + + if (point3Ds.Length > 0) + { + StartingWorldPoint = point3Ds[0]; + EndingWorldPoint = point3Ds[point3Ds.Length - 1]; + } + } + + public override string ToString() + { + return Name; + } + } +} \ No newline at end of file Index: src/Plugins/Wti/Wti.Data/Wti.Data.csproj =================================================================== diff -u -r65260b1c152bf584ac4d6bdb68f6e4d115c513a0 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Data/Wti.Data.csproj (.../Wti.Data.csproj) (revision 65260b1c152bf584ac4d6bdb68f6e4d115c513a0) +++ src/Plugins/Wti/Wti.Data/Wti.Data.csproj (.../Wti.Data.csproj) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -48,7 +48,7 @@ - + Index: src/Plugins/Wti/Wti.Forms/NodePresenters/PipingCalculationInputsNodePresenter.cs =================================================================== diff -u -rf65154bc499025f9f5b37b9de0ebdf8026336020 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Forms/NodePresenters/PipingCalculationInputsNodePresenter.cs (.../PipingCalculationInputsNodePresenter.cs) (revision f65154bc499025f9f5b37b9de0ebdf8026336020) +++ src/Plugins/Wti/Wti.Forms/NodePresenters/PipingCalculationInputsNodePresenter.cs (.../PipingCalculationInputsNodePresenter.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -80,7 +80,7 @@ public ContextMenuStrip GetContextMenu(ITreeNode sender, object nodeData) { - var contextMenu = new PipingContextMenuStrip((PipingData) nodeData); + var contextMenu = new PipingContextMenuStrip(((PipingCalculationInputs) nodeData).PipingData); contextMenu.OnCalculationClick += PerformPipingCalculation; contextMenu.OnValidationClick += PerformPipingValidation; Index: src/Plugins/Wti/Wti.Forms/NodePresenters/PipingSurfaceLineCollectionNodePresenter.cs =================================================================== diff -u -rfa9b36343401d44cb6813d7871903782d0dedec9 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Forms/NodePresenters/PipingSurfaceLineCollectionNodePresenter.cs (.../PipingSurfaceLineCollectionNodePresenter.cs) (revision fa9b36343401d44cb6813d7871903782d0dedec9) +++ src/Plugins/Wti/Wti.Forms/NodePresenters/PipingSurfaceLineCollectionNodePresenter.cs (.../PipingSurfaceLineCollectionNodePresenter.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -14,13 +14,13 @@ namespace Wti.Forms.NodePresenters { /// - /// Tree node presenter representing the collection of available for piping + /// Tree node presenter representing the collection of available for piping /// calculations. /// public class PipingSurfaceLineCollectionNodePresenter : ITreeNodePresenter { /// - /// Injects the action to be performed when importing + /// Injects the action to be performed when importing /// instances to . /// public Action ImportSurfaceLinesAction { private get; set; } @@ -31,21 +31,21 @@ { get { - return typeof(IEnumerable); + return typeof(IEnumerable); } } public void UpdateNode(ITreeNode parentNode, ITreeNode node, object nodeData) { - var data = (IEnumerable)nodeData; + var data = (IEnumerable)nodeData; node.Text = Resources.PipingSurfaceLinesCollectionName; node.ForegroundColor = data.Any() ? Color.FromKnownColor(KnownColor.ControlText) : Color.FromKnownColor(KnownColor.GrayText); node.Image = Resources.FolderIcon; } public IEnumerable GetChildNodeObjects(object parentNodeData, ITreeNode node) { - var surfaceLines = (IEnumerable) parentNodeData; + var surfaceLines = (IEnumerable) parentNodeData; foreach (var pipingSurfaceLine in surfaceLines) { yield return pipingSurfaceLine; Index: src/Plugins/Wti/Wti.Forms/NodePresenters/PipingSurfaceLineNodePresenter.cs =================================================================== diff -u -rab8c3b732c3aaadc8e55be98e132bdaf41110169 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Forms/NodePresenters/PipingSurfaceLineNodePresenter.cs (.../PipingSurfaceLineNodePresenter.cs) (revision ab8c3b732c3aaadc8e55be98e132bdaf41110169) +++ src/Plugins/Wti/Wti.Forms/NodePresenters/PipingSurfaceLineNodePresenter.cs (.../PipingSurfaceLineNodePresenter.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -6,11 +6,11 @@ namespace Wti.Forms.NodePresenters { /// - /// Node presenter for data nodes in the project tree view. + /// Node presenter for data nodes in the project tree view. /// - public class PipingSurfaceLineNodePresenter : PipingNodePresenterBase + public class PipingSurfaceLineNodePresenter : PipingNodePresenterBase { - protected override void UpdateNode(ITreeNode parentNode, ITreeNode node, PipingSurfaceLine nodeData) + protected override void UpdateNode(ITreeNode parentNode, ITreeNode node, RingtoetsPipingSurfaceLine nodeData) { node.Text = nodeData.Name; node.Image = Resources.PipingSurfaceLineIcon; Index: src/Plugins/Wti/Wti.Forms/PresentationObjects/PipingCalculationInputs.cs =================================================================== diff -u -rf65154bc499025f9f5b37b9de0ebdf8026336020 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Forms/PresentationObjects/PipingCalculationInputs.cs (.../PipingCalculationInputs.cs) (revision f65154bc499025f9f5b37b9de0ebdf8026336020) +++ src/Plugins/Wti/Wti.Forms/PresentationObjects/PipingCalculationInputs.cs (.../PipingCalculationInputs.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -1,6 +1,8 @@ using System.Collections.Generic; using System.Linq; +using DelftTools.Shell.Core; + using Wti.Data; namespace Wti.Forms.PresentationObjects @@ -9,14 +11,14 @@ /// Presentation object for all data required to configure an instance of /// in order to prepare it for performing a calculation. /// - public class PipingCalculationInputs + public class PipingCalculationInputs : IObservable { /// /// Initializes a new instance of the class. /// public PipingCalculationInputs() { - AvailablePipingSurfaceLines = Enumerable.Empty(); + AvailablePipingSurfaceLines = Enumerable.Empty(); } /// @@ -28,6 +30,25 @@ /// Gets or sets the available piping surface lines in order for the user to select /// one to set . /// - public IEnumerable AvailablePipingSurfaceLines { get; set; } + public IEnumerable AvailablePipingSurfaceLines { get; set; } + + #region IObservable + + public void Attach(IObserver observer) + { + PipingData.Attach(observer); + } + + public void Detach(IObserver observer) + { + PipingData.Detach(observer); + } + + public void NotifyObservers() + { + PipingData.NotifyObservers(); + } + + #endregion } } \ No newline at end of file Index: src/Plugins/Wti/Wti.Forms/PropertyClasses/PipingCalculationInputsProperties.cs =================================================================== diff -u -r9cd3db94455d7ac8ec96d2504f46ca66a203a724 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Forms/PropertyClasses/PipingCalculationInputsProperties.cs (.../PipingCalculationInputsProperties.cs) (revision 9cd3db94455d7ac8ec96d2504f46ca66a203a724) +++ src/Plugins/Wti/Wti.Forms/PropertyClasses/PipingCalculationInputsProperties.cs (.../PipingCalculationInputsProperties.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -355,7 +355,7 @@ [ResourcesCategory(typeof(Resources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "PipingDataSurfaceLineDisplayName")] [ResourcesDescription(typeof(Resources), "PipingDataSurfaceLineDescription")] - public PipingSurfaceLine SurfaceLine + public RingtoetsPipingSurfaceLine SurfaceLine { get { @@ -371,7 +371,7 @@ /// /// Gets the available surface lines on . /// - public IEnumerable GetAvailableSurfaceLines() + public IEnumerable GetAvailableSurfaceLines() { return data.AvailablePipingSurfaceLines; } Index: src/Plugins/Wti/Wti.Forms/PropertyClasses/PipingSurfaceLineProperties.cs =================================================================== diff -u -r8045811eb2d3f933055693da387980f6354e3847 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Forms/PropertyClasses/PipingSurfaceLineProperties.cs (.../PipingSurfaceLineProperties.cs) (revision 8045811eb2d3f933055693da387980f6354e3847) +++ src/Plugins/Wti/Wti.Forms/PropertyClasses/PipingSurfaceLineProperties.cs (.../PipingSurfaceLineProperties.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -10,10 +10,10 @@ namespace Wti.Forms.PropertyClasses { /// - /// ViewModel of for properties panel. + /// ViewModel of for properties panel. /// [ResourcesDisplayName(typeof(Resources), "SurfaceLinePropertiesDisplayName")] - public class PipingSurfaceLineProperties : ObjectProperties + public class PipingSurfaceLineProperties : ObjectProperties { [ResourcesCategory(typeof(Resources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "PipingSurfaceLineNameDisplayName")] Index: src/Plugins/Wti/Wti.Forms/UITypeEditors/PipingCalculationInputsSurfaceLineSelectionEditor.cs =================================================================== diff -u -r9cd3db94455d7ac8ec96d2504f46ca66a203a724 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Forms/UITypeEditors/PipingCalculationInputsSurfaceLineSelectionEditor.cs (.../PipingCalculationInputsSurfaceLineSelectionEditor.cs) (revision 9cd3db94455d7ac8ec96d2504f46ca66a203a724) +++ src/Plugins/Wti/Wti.Forms/UITypeEditors/PipingCalculationInputsSurfaceLineSelectionEditor.cs (.../PipingCalculationInputsSurfaceLineSelectionEditor.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -14,7 +14,7 @@ { /// /// This class defines a drop down list edit-control from which the user can select a - /// from a collection. + /// from a collection. /// public class PipingCalculationInputsSurfaceLineSelectionEditor : UITypeEditor { @@ -51,7 +51,7 @@ var listBox = new ListBox { SelectionMode = SelectionMode.One, - DisplayMember = TypeUtils.GetMemberName(sl => sl.Name) + DisplayMember = TypeUtils.GetMemberName(sl => sl.Name) }; listBox.SelectedValueChanged += (sender, eventArgs) => editorService.CloseDropDown(); Index: src/Plugins/Wti/Wti.IO/PipingSurfaceLinesCsvReader.cs =================================================================== diff -u -raa2e48b57a92d8f3703cb27e92bb538bfc5b6ff9 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.IO/PipingSurfaceLinesCsvReader.cs (.../PipingSurfaceLinesCsvReader.cs) (revision aa2e48b57a92d8f3703cb27e92bb538bfc5b6ff9) +++ src/Plugins/Wti/Wti.IO/PipingSurfaceLinesCsvReader.cs (.../PipingSurfaceLinesCsvReader.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -54,7 +54,7 @@ } /// - /// Reads the file to determine the number of available + /// Reads the file to determine the number of available /// data rows. /// /// A value greater than or equal to 0. @@ -80,7 +80,7 @@ /// /// Reads and consumes the next data row, parsing the data to create an instance - /// of . + /// of . /// /// Return the parse surfaceline, or null when at the end of the file. /// A critical error has occurred, which may be caused by: @@ -102,7 +102,7 @@ /// The row is missing values to form a surface line point. /// /// - public PipingSurfaceLine ReadLine() + public RingtoetsPipingSurfaceLine ReadLine() { if (fileReader == null) { @@ -122,7 +122,7 @@ var surfaceLineName = GetSurfaceLineName(tokenizedString); var points = GetSurfaceLinePoints(tokenizedString); - var surfaceLine = new PipingSurfaceLine + var surfaceLine = new RingtoetsPipingSurfaceLine { Name = surfaceLineName }; Index: src/Plugins/Wti/Wti.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs =================================================================== diff -u -raa2e48b57a92d8f3703cb27e92bb538bfc5b6ff9 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision aa2e48b57a92d8f3703cb27e92bb538bfc5b6ff9) +++ src/Plugins/Wti/Wti.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -60,7 +60,7 @@ { return new[] { - typeof(IEnumerable) + typeof(IEnumerable) }; } } @@ -96,7 +96,7 @@ public bool CanImportOn(object targetObject) { - return targetObject is ICollection; + return targetObject is ICollection; } public object ImportItem(string path, object target = null) @@ -152,7 +152,7 @@ return HandleCriticalError(path, e); } - var readSurfaceLines = new List(itemCount); + var readSurfaceLines = new List(itemCount); for (int i = 0; i < itemCount && !ShouldCancel; i++) { try @@ -186,11 +186,11 @@ return new SurfaceLinesFileReadResult(true); } - private void AddImportedDataToModel(object target, ICollection readSurfaceLines) + private void AddImportedDataToModel(object target, ICollection readSurfaceLines) { NotifyProgress(ApplicationResources.PipingSurfaceLinesCsvImporter_AddingImportedDataToModel, readSurfaceLines.Count, readSurfaceLines.Count); - var targetCollection = (ICollection)target; + var targetCollection = (ICollection)target; foreach (var readSurfaceLine in readSurfaceLines) { targetCollection.Add(readSurfaceLine); @@ -213,10 +213,10 @@ public SurfaceLinesFileReadResult(bool errorOccurred) { CriticalErrorOccurred = errorOccurred; - ImportedSurfaceLines = new PipingSurfaceLine[0]; + ImportedSurfaceLines = new RingtoetsPipingSurfaceLine[0]; } - public ICollection ImportedSurfaceLines { get; set; } + public ICollection ImportedSurfaceLines { get; set; } public bool CriticalErrorOccurred { get; private set; } } Index: src/Plugins/Wti/Wti.Plugin/WtiGuiPlugin.cs =================================================================== diff -u -rf65154bc499025f9f5b37b9de0ebdf8026336020 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Plugin/WtiGuiPlugin.cs (.../WtiGuiPlugin.cs) (revision f65154bc499025f9f5b37b9de0ebdf8026336020) +++ src/Plugins/Wti/Wti.Plugin/WtiGuiPlugin.cs (.../WtiGuiPlugin.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -70,7 +70,7 @@ }; yield return new PropertyInfo { - ObjectType = typeof(PipingSurfaceLine), PropertyType = typeof(PipingSurfaceLineProperties) + ObjectType = typeof(RingtoetsPipingSurfaceLine), PropertyType = typeof(PipingSurfaceLineProperties) }; } Index: src/Plugins/Wti/Wti.Service/PipingCalculationService.cs =================================================================== diff -u -rfcedd294bc5bb311a5612e0b07b3fc4149456c54 -r9260afadbd7ccee6409417730493babf258cc103 --- src/Plugins/Wti/Wti.Service/PipingCalculationService.cs (.../PipingCalculationService.cs) (revision fcedd294bc5bb311a5612e0b07b3fc4149456c54) +++ src/Plugins/Wti/Wti.Service/PipingCalculationService.cs (.../PipingCalculationService.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -120,7 +120,8 @@ pipingData.ThicknessAquiferLayer, pipingData.MeanDiameter70, pipingData.BeddingAngle, - pipingData.ExitPointXCoordinate + pipingData.ExitPointXCoordinate, + pipingData.SurfaceLine ); } } Index: test/Plugins/Wti/Wti.Calculation.Test/Piping/PipingCalculationInputTest.cs =================================================================== diff -u -re61dfe357a722430029affaa9a28e6bd2cbbc281 -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Calculation.Test/Piping/PipingCalculationInputTest.cs (.../PipingCalculationInputTest.cs) (revision e61dfe357a722430029affaa9a28e6bd2cbbc281) +++ test/Plugins/Wti/Wti.Calculation.Test/Piping/PipingCalculationInputTest.cs (.../PipingCalculationInputTest.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -1,6 +1,7 @@ using System; using NUnit.Framework; using Wti.Calculation.Piping; +using Wti.Data; namespace Wti.Calculation.Test.Piping { @@ -33,6 +34,7 @@ double meanDiameter70Value = random.NextDouble(); double beddingAngleValue = random.NextDouble(); double exitPointXCoordinate = random.NextDouble(); + var surfaceLine = new RingtoetsPipingSurfaceLine(); var input = new PipingCalculationInput( volumetricWeightOfWaterValue, @@ -56,30 +58,32 @@ thicknessAquiferLayerValue, meanDiameter70Value, beddingAngleValue, - exitPointXCoordinate); + exitPointXCoordinate, + surfaceLine); - Assert.That(input.WaterVolumetricWeight, Is.EqualTo(volumetricWeightOfWaterValue)); - Assert.That(input.UpliftModelFactor, Is.EqualTo(modelFactorUpliftValue)); - Assert.That(input.AssessmentLevel, Is.EqualTo(hRiverValue)); - Assert.That(input.PiezometricHeadExit, Is.EqualTo(phiExitValue)); - Assert.That(input.DampingFactorExit, Is.EqualTo(rExitValue)); - Assert.That(input.PhreaticLevelExit, Is.EqualTo(hExitValue)); - Assert.That(input.PiezometricHeadPolder, Is.EqualTo(phiPolderValue)); - Assert.That(input.CriticalHeaveGradient, Is.EqualTo(ichValue)); - Assert.That(input.ThicknessCoverageLayer, Is.EqualTo(dTotalValue)); - Assert.That(input.SellmeijerModelFactor, Is.EqualTo(sellmeijerModelFactorValue)); - Assert.That(input.SellmeijerReductionFactor, Is.EqualTo(reductionFactorValue)); - Assert.That(input.SeepageLength, Is.EqualTo(seepageLengthValue)); - Assert.That(input.SandParticlesVolumicWeight, Is.EqualTo(sandParticlesVolumicWeightValue)); - Assert.That(input.WhitesDragCoefficient, Is.EqualTo(whitesDragCoefficientValue)); - Assert.That(input.Diameter70, Is.EqualTo(diameter70Value)); - Assert.That(input.DarcyPermeability, Is.EqualTo(darcyPermeabilityValue)); - Assert.That(input.WaterKinematicViscosity, Is.EqualTo(waterKinematicViscosityValue)); - Assert.That(input.Gravity, Is.EqualTo(gravityValue)); - Assert.That(input.ThicknessAquiferLayer, Is.EqualTo(thicknessAquiferLayerValue)); - Assert.That(input.MeanDiameter70, Is.EqualTo(meanDiameter70Value)); - Assert.That(input.BeddingAngle, Is.EqualTo(beddingAngleValue)); - Assert.That(input.ExitPointXCoordinate, Is.EqualTo(exitPointXCoordinate)); + Assert.AreEqual(volumetricWeightOfWaterValue, input.WaterVolumetricWeight); + Assert.AreEqual(modelFactorUpliftValue, input.UpliftModelFactor); + Assert.AreEqual(hRiverValue, input.AssessmentLevel); + Assert.AreEqual(phiExitValue, input.PiezometricHeadExit); + Assert.AreEqual(rExitValue, input.DampingFactorExit); + Assert.AreEqual(hExitValue, input.PhreaticLevelExit); + Assert.AreEqual(phiPolderValue, input.PiezometricHeadPolder); + Assert.AreEqual(ichValue, input.CriticalHeaveGradient); + Assert.AreEqual(dTotalValue, input.ThicknessCoverageLayer); + Assert.AreEqual(sellmeijerModelFactorValue, input.SellmeijerModelFactor); + Assert.AreEqual(reductionFactorValue, input.SellmeijerReductionFactor); + Assert.AreEqual(seepageLengthValue, input.SeepageLength); + Assert.AreEqual(sandParticlesVolumicWeightValue, input.SandParticlesVolumicWeight); + Assert.AreEqual(whitesDragCoefficientValue, input.WhitesDragCoefficient); + Assert.AreEqual(diameter70Value, input.Diameter70); + Assert.AreEqual(darcyPermeabilityValue, input.DarcyPermeability); + Assert.AreEqual(waterKinematicViscosityValue, input.WaterKinematicViscosity); + Assert.AreEqual(gravityValue, input.Gravity); + Assert.AreEqual(thicknessAquiferLayerValue, input.ThicknessAquiferLayer); + Assert.AreEqual(meanDiameter70Value, input.MeanDiameter70); + Assert.AreEqual(beddingAngleValue, input.BeddingAngle); + Assert.AreEqual(exitPointXCoordinate, input.ExitPointXCoordinate); + Assert.AreSame(surfaceLine, input.SurfaceLine); } } } \ No newline at end of file Index: test/Plugins/Wti/Wti.Calculation.Test/Piping/PipingCalculationTest.cs =================================================================== diff -u -r97ebda114265b9ccdc6cf73bab8312e5422e3de4 -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Calculation.Test/Piping/PipingCalculationTest.cs (.../PipingCalculationTest.cs) (revision 97ebda114265b9ccdc6cf73bab8312e5422e3de4) +++ test/Plugins/Wti/Wti.Calculation.Test/Piping/PipingCalculationTest.cs (.../PipingCalculationTest.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -2,7 +2,7 @@ using System.Linq; using NUnit.Framework; using Wti.Calculation.Piping; -using Wti.Calculation.Test.Piping.Stub; +using Wti.Calculation.TestUtil; namespace Wti.Calculation.Test.Piping { @@ -215,6 +215,25 @@ } [Test] + public void Validate_NoSurfaceLineSet_ValidationMessageForHavingNoSurfaceLineSelected() + { + // Setup + PipingCalculationInput input = new TestPipingInput + { + SurfaceLine = null, + }.AsRealInput(); + + var calculation = new PipingCalculation(input); + + // Call + List validationMessages = calculation.Validate(); + + // Assert + Assert.AreEqual(1, validationMessages.Count); + Assert.AreEqual("Een dwarsdoorsnede moet geselecteerd zijn om een Uplift berekening uit te kunnen voeren.", validationMessages[0]); + } + + [Test] public void Validate_AssessmentLevelPhreaticLevelExitSellmeijerReductionFactorThicknessCoverageLayerZero_ValidationMessageForHRiverHExitRcDTotalAndDTotal() { // Setup Index: test/Plugins/Wti/Wti.Calculation.Test/Piping/PipingSurfaceLineCreatorTest.cs =================================================================== diff -u -re4bd298c3f3762925531b11517a0f57b7005e5ad -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Calculation.Test/Piping/PipingSurfaceLineCreatorTest.cs (.../PipingSurfaceLineCreatorTest.cs) (revision e4bd298c3f3762925531b11517a0f57b7005e5ad) +++ test/Plugins/Wti/Wti.Calculation.Test/Piping/PipingSurfaceLineCreatorTest.cs (.../PipingSurfaceLineCreatorTest.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -1,6 +1,9 @@ -using Deltares.WTIPiping; +using System.Linq; + +using Deltares.WTIPiping; using NUnit.Framework; using Wti.Calculation.Piping; +using Wti.Data; namespace Wti.Calculation.Test.Piping { @@ -9,14 +12,28 @@ [Test] public void Create_Always_ReturnsSurfaceLineWithASinglePointAtOrigin() { + // Setup + const string name = "Local coordinate surfaceline"; + var surfaceLine = new RingtoetsPipingSurfaceLine + { + Name = name + }; + surfaceLine.SetGeometry(new[] + { + new Point3D { X = 0.0, Y = 0.0, Z = 1.1 }, + new Point3D { X = 2.2, Y = 0.0, Z = 3.3 }, + new Point3D { X = 4.4, Y = 0.0, Z = 5.5 } + }); + // Call - PipingSurfaceLine actual = PipingSurfaceLineCreator.Create(); + PipingSurfaceLine actual = PipingSurfaceLineCreator.Create(surfaceLine); // Assert - Assert.AreEqual(1, actual.Points.Count); - Assert.AreEqual(0, actual.Points[0].X); - Assert.AreEqual(0, actual.Points[0].Y); - Assert.AreEqual(0, actual.Points[0].Z); + Assert.AreEqual(name, actual.Name); + CollectionAssert.AreEqual(surfaceLine.Points.Select(p => p.X).ToArray(), actual.Points.Select(p => p.X).ToArray()); + CollectionAssert.AreEqual(surfaceLine.Points.Select(p => p.Y).ToArray(), actual.Points.Select(p => p.Y).ToArray()); + CollectionAssert.AreEqual(surfaceLine.Points.Select(p => p.Z).ToArray(), actual.Points.Select(p => p.Z).ToArray()); + CollectionAssert.AreEqual(Enumerable.Repeat(PipingCharacteristicPointType.None, surfaceLine.Points.Count()), actual.Points.Select(p => p.Type)); } } } \ No newline at end of file Index: test/Plugins/Wti/Wti.Calculation.TestUtil/TestPipingInput.cs =================================================================== diff -u -r48b873c6d49827d951cf1fbcb52ea815be6b9f93 -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Calculation.TestUtil/TestPipingInput.cs (.../TestPipingInput.cs) (revision 48b873c6d49827d951cf1fbcb52ea815be6b9f93) +++ test/Plugins/Wti/Wti.Calculation.TestUtil/TestPipingInput.cs (.../TestPipingInput.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -1,7 +1,9 @@ using System; + using Wti.Calculation.Piping; +using Wti.Data; -namespace Wti.Calculation.Test.Piping.Stub +namespace Wti.Calculation.TestUtil { public class TestPipingInput { @@ -27,6 +29,7 @@ public double BeddingAngle; public double MeanDiameter70; public double ThicknessAquiferLayer; + public RingtoetsPipingSurfaceLine SurfaceLine; private readonly Random random = new Random(22); private double last; @@ -55,12 +58,17 @@ BeddingAngle = NextIncrementalDouble(); MeanDiameter70 = NextIncrementalDouble(); ThicknessAquiferLayer = NextIncrementalDouble(); + SurfaceLine = CreateValidSurfaceLine(); } + private RingtoetsPipingSurfaceLine CreateValidSurfaceLine() + { + return new RingtoetsPipingSurfaceLine(); + } + /// /// The returned double is sure to be different from the last time it was called. /// - /// private double NextIncrementalDouble() { return last += random.NextDouble() + 1e-6; @@ -69,7 +77,6 @@ /// /// Returns the current set value as a /// - /// public PipingCalculationInput AsRealInput() { return new PipingCalculationInput( @@ -94,7 +101,8 @@ ThicknessAquiferLayer, MeanDiameter70, BeddingAngle, - ExitPointXCoordinate + ExitPointXCoordinate, + SurfaceLine ); } } Index: test/Plugins/Wti/Wti.Data.Test/PipingFailureMechanismTest.cs =================================================================== diff -u -rab8c3b732c3aaadc8e55be98e132bdaf41110169 -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Data.Test/PipingFailureMechanismTest.cs (.../PipingFailureMechanismTest.cs) (revision ab8c3b732c3aaadc8e55be98e132bdaf41110169) +++ test/Plugins/Wti/Wti.Data.Test/PipingFailureMechanismTest.cs (.../PipingFailureMechanismTest.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -23,7 +23,7 @@ // assert CollectionAssert.IsEmpty(piping.SurfaceLines); - Assert.IsInstanceOf>(piping.SurfaceLines); + Assert.IsInstanceOf>(piping.SurfaceLines); CollectionAssert.IsEmpty(piping.SoilProfiles); Assert.IsNotNull(piping.PipingData); } Fisheye: Tag 9260afadbd7ccee6409417730493babf258cc103 refers to a dead (removed) revision in file `test/Plugins/Wti/Wti.Data.Test/PipingSurfaceLineTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: test/Plugins/Wti/Wti.Data.Test/RingtoetsPipingSurfaceLineTest.cs =================================================================== diff -u --- test/Plugins/Wti/Wti.Data.Test/RingtoetsPipingSurfaceLineTest.cs (revision 0) +++ test/Plugins/Wti/Wti.Data.Test/RingtoetsPipingSurfaceLineTest.cs (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -0,0 +1,82 @@ +using System; +using System.Linq; + +using NUnit.Framework; + +namespace Wti.Data.Test +{ + [TestFixture] + public class RingtoetsPipingSurfaceLineTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // Call + var surfaceLine = new RingtoetsPipingSurfaceLine(); + + // Assert + Assert.AreEqual(String.Empty, surfaceLine.Name); + CollectionAssert.IsEmpty(surfaceLine.Points); + Assert.IsNull(surfaceLine.StartingWorldPoint); + Assert.IsNull(surfaceLine.EndingWorldPoint); + } + + [Test] + public void SetGeometry_EmptyCollection_PointsSetEmptyAndNullStartAndEndWorldPoints() + { + // Setup + var surfaceLine = new RingtoetsPipingSurfaceLine(); + + var sourceData = Enumerable.Empty(); + + // Call + surfaceLine.SetGeometry(sourceData); + + // Assert + CollectionAssert.IsEmpty(surfaceLine.Points); + Assert.IsNull(surfaceLine.StartingWorldPoint); + Assert.IsNull(surfaceLine.EndingWorldPoint); + } + + [Test] + public void SetGeometry_CollectionOfOnePoint_InitializeStartAndEndWorldPointsToSameInstanceAndInitializePoints() + { + // Setup + var surfaceLine = new RingtoetsPipingSurfaceLine(); + + var sourceData = new[] + { + new Point3D + { + X = 1.1, Y = 2.2, Z = 3.3 + } + }; + + // Call + surfaceLine.SetGeometry(sourceData); + + // Assert + Assert.AreNotSame(sourceData, surfaceLine.Points); + CollectionAssert.AreEqual(sourceData, surfaceLine.Points); + Assert.AreSame(sourceData[0], surfaceLine.StartingWorldPoint); + Assert.AreSame(sourceData[0], surfaceLine.EndingWorldPoint); + } + + [Test] + public void ToString_ReturnName() + { + // Setup + const string niceName = "Nice name"; + var surfaceLine = new RingtoetsPipingSurfaceLine + { + Name = niceName + }; + + // Call + var text = surfaceLine.ToString(); + + // Assert + Assert.AreEqual(niceName, text); + } + } +} \ No newline at end of file Index: test/Plugins/Wti/Wti.Data.Test/Wti.Data.Test.csproj =================================================================== diff -u -r2423a70958e7fecfc92afa462c34194cc695a81e -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Data.Test/Wti.Data.Test.csproj (.../Wti.Data.Test.csproj) (revision 2423a70958e7fecfc92afa462c34194cc695a81e) +++ test/Plugins/Wti/Wti.Data.Test/Wti.Data.Test.csproj (.../Wti.Data.Test.csproj) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -48,7 +48,7 @@ - + Index: test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingCalculationInputsNodePresenterTest.cs =================================================================== diff -u -rf65154bc499025f9f5b37b9de0ebdf8026336020 -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingCalculationInputsNodePresenterTest.cs (.../PipingCalculationInputsNodePresenterTest.cs) (revision f65154bc499025f9f5b37b9de0ebdf8026336020) +++ test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingCalculationInputsNodePresenterTest.cs (.../PipingCalculationInputsNodePresenterTest.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -7,6 +7,7 @@ using NUnit.Framework; using Rhino.Mocks; using Wti.Calculation.Test.Piping.Stub; +using Wti.Calculation.TestUtil; using Wti.Data; using Wti.Forms.NodePresenters; using Wti.Forms.PresentationObjects; Index: test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingSurfaceLineCollectionNodePresenterTest.cs =================================================================== diff -u -r9e0b372066f8d8be8c231b3be8922d29a1c61e1f -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingSurfaceLineCollectionNodePresenterTest.cs (.../PipingSurfaceLineCollectionNodePresenterTest.cs) (revision 9e0b372066f8d8be8c231b3be8922d29a1c61e1f) +++ test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingSurfaceLineCollectionNodePresenterTest.cs (.../PipingSurfaceLineCollectionNodePresenterTest.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -26,7 +26,7 @@ // Assert Assert.IsInstanceOf(nodePresenter); Assert.IsNull(nodePresenter.TreeView); - Assert.AreEqual(typeof(IEnumerable), nodePresenter.NodeTagType); + Assert.AreEqual(typeof(IEnumerable), nodePresenter.NodeTagType); } [Test] @@ -39,7 +39,7 @@ var nodePresenter = new PipingSurfaceLineCollectionNodePresenter(); - IEnumerable surfaceLinesCollection = new[]{ new PipingSurfaceLine() }; + IEnumerable surfaceLinesCollection = new[]{ new RingtoetsPipingSurfaceLine() }; // Call nodePresenter.UpdateNode(null, surfaceLinesCollectionNodeMock, surfaceLinesCollection); @@ -61,7 +61,7 @@ var nodePresenter = new PipingSurfaceLineCollectionNodePresenter(); - IEnumerable surfaceLinesCollection = Enumerable.Empty(); + IEnumerable surfaceLinesCollection = Enumerable.Empty(); // Call nodePresenter.UpdateNode(null, surfaceLinesCollectionNodeMock, surfaceLinesCollection); @@ -83,10 +83,10 @@ var nodePresenter = new PipingSurfaceLineCollectionNodePresenter(); - IEnumerable surfaceLinesCollection = new[] + IEnumerable surfaceLinesCollection = new[] { - new PipingSurfaceLine(), - new PipingSurfaceLine() + new RingtoetsPipingSurfaceLine(), + new RingtoetsPipingSurfaceLine() }; // Call Index: test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingSurfaceLineNodePresenterTest.cs =================================================================== diff -u -rab8c3b732c3aaadc8e55be98e132bdaf41110169 -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingSurfaceLineNodePresenterTest.cs (.../PipingSurfaceLineNodePresenterTest.cs) (revision ab8c3b732c3aaadc8e55be98e132bdaf41110169) +++ test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingSurfaceLineNodePresenterTest.cs (.../PipingSurfaceLineNodePresenterTest.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -19,7 +19,7 @@ var nodePresenter = new PipingSurfaceLineNodePresenter(); // Assert - Assert.IsInstanceOf>(nodePresenter); + Assert.IsInstanceOf>(nodePresenter); } [Test] @@ -32,7 +32,7 @@ mocks.ReplayAll(); const string name = ""; - var surfaceLine = new PipingSurfaceLine { Name = name }; + var surfaceLine = new RingtoetsPipingSurfaceLine { Name = name }; var nodePresenter = new PipingSurfaceLineNodePresenter(); Index: test/Plugins/Wti/Wti.Forms.Test/PresentationObjects/PipingCalculationInputsTest.cs =================================================================== diff -u -rf65154bc499025f9f5b37b9de0ebdf8026336020 -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Forms.Test/PresentationObjects/PipingCalculationInputsTest.cs (.../PipingCalculationInputsTest.cs) (revision f65154bc499025f9f5b37b9de0ebdf8026336020) +++ test/Plugins/Wti/Wti.Forms.Test/PresentationObjects/PipingCalculationInputsTest.cs (.../PipingCalculationInputsTest.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -1,5 +1,10 @@ -using NUnit.Framework; +using DelftTools.Shell.Core; +using NUnit.Framework; + +using Rhino.Mocks; + +using Wti.Data; using Wti.Forms.PresentationObjects; namespace Wti.Forms.Test.PresentationObjects @@ -14,8 +19,76 @@ var presentationObject = new PipingCalculationInputs(); // Assert + Assert.IsInstanceOf(presentationObject); Assert.IsNull(presentationObject.PipingData); CollectionAssert.IsEmpty(presentationObject.AvailablePipingSurfaceLines); } + + [Test] + public void NotifyObservers_HasPipingDataAndObserverAttached_NotifyObserver() + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + var presentationObject = new PipingCalculationInputs + { + PipingData = new PipingData() + }; + presentationObject.Attach(observer); + + // Call + presentationObject.NotifyObservers(); + + // Assert + mocks.VerifyAll(); + } + + [Test] + public void NotifyObservers_HasPipingDataAndObserverDetached_NoCallsOnObserver() + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + mocks.ReplayAll(); + + var presentationObject = new PipingCalculationInputs + { + PipingData = new PipingData() + }; + presentationObject.Attach(observer); + presentationObject.Detach(observer); + + // Call + presentationObject.NotifyObservers(); + + // Assert + mocks.VerifyAll(); // Expect not calls on 'observer' + } + + [Test] + public void PipingDataNotifyObservers_AttachedOnPipingCalculationInputs_ObserverNotified() + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + var pipingData = new PipingData(); + var presentationObject = new PipingCalculationInputs + { + PipingData = pipingData + }; + presentationObject.Attach(observer); + + // Call + pipingData.NotifyObservers(); + + // Assert + mocks.VerifyAll(); + } } } \ No newline at end of file Index: test/Plugins/Wti/Wti.Forms.Test/PropertyClasses/PipingCalculationInputsPropertiesTest.cs =================================================================== diff -u -rf65154bc499025f9f5b37b9de0ebdf8026336020 -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Forms.Test/PropertyClasses/PipingCalculationInputsPropertiesTest.cs (.../PipingCalculationInputsPropertiesTest.cs) (revision f65154bc499025f9f5b37b9de0ebdf8026336020) +++ test/Plugins/Wti/Wti.Forms.Test/PropertyClasses/PipingCalculationInputsPropertiesTest.cs (.../PipingCalculationInputsPropertiesTest.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -26,7 +26,7 @@ public void GetProperties_WithData_ReturnExpectedValues() { // Setup - var surfaceLine = new PipingSurfaceLine(); + var surfaceLine = new RingtoetsPipingSurfaceLine(); var pipingData = new PipingData { SurfaceLine = surfaceLine Index: test/Plugins/Wti/Wti.Forms.Test/PropertyClasses/PipingSurfaceLinePropertiesTest.cs =================================================================== diff -u -rdd0526758fbd88f786a78a847b84a58faf464c1b -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Forms.Test/PropertyClasses/PipingSurfaceLinePropertiesTest.cs (.../PipingSurfaceLinePropertiesTest.cs) (revision dd0526758fbd88f786a78a847b84a58faf464c1b) +++ test/Plugins/Wti/Wti.Forms.Test/PropertyClasses/PipingSurfaceLinePropertiesTest.cs (.../PipingSurfaceLinePropertiesTest.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -17,7 +17,7 @@ var properties = new PipingSurfaceLineProperties(); // Assert - Assert.IsInstanceOf>(properties); + Assert.IsInstanceOf>(properties); Assert.IsNull(properties.Data); } @@ -26,7 +26,7 @@ { // Setup const string expectedName = ""; - var surfaceLine = new PipingSurfaceLine + var surfaceLine = new RingtoetsPipingSurfaceLine { Name = expectedName }; Index: test/Plugins/Wti/Wti.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs =================================================================== diff -u -r91ec76d4b8a0fcf5962f442021c43f1ffa70743e -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs (.../PipingSurfaceLineCsvImporterTest.cs) (revision 91ec76d4b8a0fcf5962f442021c43f1ffa70743e) +++ test/Plugins/Wti/Wti.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs (.../PipingSurfaceLineCsvImporterTest.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -35,7 +35,7 @@ Assert.AreEqual(ApplicationResources.WtiApplicationName, importer.Category); Assert.AreEqual(16, importer.Image.Width); Assert.AreEqual(16, importer.Image.Height); - CollectionAssert.AreEqual(new[]{typeof(IEnumerable)}, importer.SupportedItemTypes); + CollectionAssert.AreEqual(new[]{typeof(IEnumerable)}, importer.SupportedItemTypes); Assert.IsFalse(importer.CanImportOnRootLevel); var expectedFileFilter = String.Format("{0} {1} (*.csv)|*.csv", WtiFormsResources.PipingSurfaceLinesCollectionName, ApplicationResources.CsvFileName); @@ -51,7 +51,7 @@ { // Setup var mocks = new MockRepository(); - var validTarget = mocks.StrictMock>(); + var validTarget = mocks.StrictMock>(); mocks.ReplayAll(); var importer = new PipingSurfaceLinesCsvImporter(); @@ -69,7 +69,7 @@ { // Setup var mocks = new MockRepository(); - var invalidTarget = mocks.StrictMock>(); + var invalidTarget = mocks.StrictMock>(); mocks.ReplayAll(); var importer = new PipingSurfaceLinesCsvImporter(); @@ -95,7 +95,7 @@ observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); - var observableSurfaceLinesList = new ObservableList(); + var observableSurfaceLinesList = new ObservableList(); observableSurfaceLinesList.Attach(observer); var importer = new PipingSurfaceLinesCsvImporter(); @@ -158,7 +158,7 @@ var observer = mocks.StrictMock(); mocks.ReplayAll(); - var observableSurfaceLinesList = new ObservableList(); + var observableSurfaceLinesList = new ObservableList(); observableSurfaceLinesList.Attach(observer); var importer = new PipingSurfaceLinesCsvImporter(); @@ -196,7 +196,7 @@ var importer = new PipingSurfaceLinesCsvImporter(); - var observableSurfaceLinesList = new ObservableList(); + var observableSurfaceLinesList = new ObservableList(); observableSurfaceLinesList.Attach(observer); object importedItem = null; @@ -228,7 +228,7 @@ var importer = new PipingSurfaceLinesCsvImporter(); - var observableSurfaceLinesList = new ObservableList(); + var observableSurfaceLinesList = new ObservableList(); observableSurfaceLinesList.Attach(observer); object importedItem = null; @@ -260,7 +260,7 @@ var importer = new PipingSurfaceLinesCsvImporter(); - var observableSurfaceLinesList = new ObservableList(); + var observableSurfaceLinesList = new ObservableList(); observableSurfaceLinesList.Attach(observer); object importedItem = null; @@ -292,7 +292,7 @@ var importer = new PipingSurfaceLinesCsvImporter(); - var observableSurfaceLinesList = new ObservableList(); + var observableSurfaceLinesList = new ObservableList(); observableSurfaceLinesList.Attach(observer); object importedItem = null; @@ -333,7 +333,7 @@ File.Delete(copyTargetPath); }; - var observableSurfaceLinesList = new ObservableList(); + var observableSurfaceLinesList = new ObservableList(); observableSurfaceLinesList.Attach(observer); object importedItem = null; @@ -380,7 +380,7 @@ progressCallCount++; }; - var observableSurfaceLinesList = new ObservableList(); + var observableSurfaceLinesList = new ObservableList(); observableSurfaceLinesList.Attach(observer); object importedItem = null; Index: test/Plugins/Wti/Wti.Plugin.Test/WtiGuiPluginTest.cs =================================================================== diff -u -rf65154bc499025f9f5b37b9de0ebdf8026336020 -r9260afadbd7ccee6409417730493babf258cc103 --- test/Plugins/Wti/Wti.Plugin.Test/WtiGuiPluginTest.cs (.../WtiGuiPluginTest.cs) (revision f65154bc499025f9f5b37b9de0ebdf8026336020) +++ test/Plugins/Wti/Wti.Plugin.Test/WtiGuiPluginTest.cs (.../WtiGuiPluginTest.cs) (revision 9260afadbd7ccee6409417730493babf258cc103) @@ -78,7 +78,7 @@ Assert.IsNull(pipingOutputProperties.GetObjectPropertiesData); Assert.IsNull(pipingOutputProperties.AfterCreate); - var pipingSurfaceLineProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(PipingSurfaceLine)); + var pipingSurfaceLineProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(RingtoetsPipingSurfaceLine)); Assert.AreEqual(typeof(PipingSurfaceLineProperties), pipingSurfaceLineProperties.PropertyType); Assert.IsNull(pipingSurfaceLineProperties.AdditionalDataCheck); Assert.IsNull(pipingSurfaceLineProperties.GetObjectPropertiesData);