Index: DeltaShell.sln =================================================================== diff -u -rf9a9443aed62fe788dc870e650592b553cf0c99a -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- DeltaShell.sln (.../DeltaShell.sln) (revision f9a9443aed62fe788dc870e650592b553cf0c99a) +++ DeltaShell.sln (.../DeltaShell.sln) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -150,9 +150,9 @@ EndProject Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "WtiSetup", "setup\Plugins\WtiSetup\WtiSetup.wixproj", "{3CCB05DB-C7B3-4EF7-B41D-22B6D2A3774E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wti.Controller", "src\Plugins\Wti\Wti.Controller\Wti.Controller.csproj", "{10B8D63D-87E8-46DF-ACA9-A8CF22EE8FB5}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wti.Service", "src\Plugins\Wti\Wti.Controller\Wti.Service.csproj", "{10B8D63D-87E8-46DF-ACA9-A8CF22EE8FB5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wti.Controller.Test", "test\Plugins\Wti\Wti.Controller.Test\Wti.Controller.Test.csproj", "{D783543B-46A1-4848-A812-AF5A5259ED7E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wti.Service.Test", "test\Plugins\Wti\Wti.Controller.Test\Wti.Service.Test.csproj", "{D783543B-46A1-4848-A812-AF5A5259ED7E}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "documentation", "documentation", "{0D2E4E16-EE0A-4E50-9218-947B1D91C84D}" EndProject Index: src/DeltaShell/DeltaShell.Gui/DeltaShell.Gui.csproj =================================================================== diff -u -ra51eb56c142408e8b239dcb3553d1d9eb85b3343 -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- src/DeltaShell/DeltaShell.Gui/DeltaShell.Gui.csproj (.../DeltaShell.Gui.csproj) (revision a51eb56c142408e8b239dcb3553d1d9eb85b3343) +++ src/DeltaShell/DeltaShell.Gui/DeltaShell.Gui.csproj (.../DeltaShell.Gui.csproj) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -289,9 +289,9 @@ {d64e4f0e-e341-496f-82b2-941ad202b4e3} Wti.Calculation - + {10b8d63d-87e8-46df-aca9-a8cf22ee8fb5} - Wti.Controller + Wti.Service {ce994cc9-6f6a-48ac-b4be-02c30a21f4db} Fisheye: Tag f4f20297137850e94b8ae0d8c582aec872d8c707 refers to a dead (removed) revision in file `src/Plugins/Wti/Wti.Controller/IContextMenuProvider.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: src/Plugins/Wti/Wti.Controller/PipingCalculationService.cs =================================================================== diff -u --- src/Plugins/Wti/Wti.Controller/PipingCalculationService.cs (revision 0) +++ src/Plugins/Wti/Wti.Controller/PipingCalculationService.cs (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -0,0 +1,63 @@ +using System; +using log4net; +using Wti.Calculation.Piping; +using Wti.Data; +using Wti.Service.Properties; + +namespace Wti.Service +{ + /// + /// This class controls the and its . + /// Interactions from the are handles by this class. + /// + public static class PipingCalculationService + { + private static readonly ILog Logger = LogManager.GetLogger(typeof(PipingCalculationService)); + + /// + /// Performs a piping calculation based on the supplied and sets + /// to the if the calculation was successful. + /// + /// The to base the input for the calculation upon. + public static void Calculate(PipingData pipingData) + { + try + { + var input = new PipingCalculationInput( + pipingData.WaterVolumetricWeight, + pipingData.UpliftModelFactor, + pipingData.AssessmentLevel, + pipingData.PiezometricHeadExit, + pipingData.DampingFactorExit, + pipingData.PhreaticLevelExit, + pipingData.PiezometricHeadPolder, + pipingData.CriticalHeaveGradient, + pipingData.ThicknessCoverageLayer, + pipingData.SellmeijerModelFactor, + pipingData.SellmeijerReductionFactor, + pipingData.SeepageLength, + pipingData.SandParticlesVolumicWeight, + pipingData.WhitesDragCoefficient, + pipingData.Diameter70, + pipingData.DarcyPermeability, + pipingData.WaterKinematicViscosity, + pipingData.Gravity, + pipingData.ThicknessAquiferLayer, + pipingData.MeanDiameter70, + pipingData.BeddingAngle, + pipingData.ExitPointXCoordinate + ); + var pipingCalculation = new PipingCalculation(input); + var pipingResult = pipingCalculation.Calculate(); + + pipingData.Output = new PipingOutput(pipingResult.UpliftZValue, + pipingResult.UpliftFactorOfSafety, + pipingResult.HeaveZValue, pipingResult.HeaveFactorOfSafety, pipingResult.SellmeijerZValue, pipingResult.SellmeijerFactorOfSafety); + } + catch (PipingCalculationException e) + { + Logger.Warn(String.Format(Resources.ErrorInPipingCalculation_0, e.Message)); + } + } + } +} \ No newline at end of file Fisheye: Tag f4f20297137850e94b8ae0d8c582aec872d8c707 refers to a dead (removed) revision in file `src/Plugins/Wti/Wti.Controller/PipingContextMenuStrip.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f4f20297137850e94b8ae0d8c582aec872d8c707 refers to a dead (removed) revision in file `src/Plugins/Wti/Wti.Controller/PipingDataNodeController.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: src/Plugins/Wti/Wti.Controller/Properties/AssemblyInfo.cs =================================================================== diff -u -r5fc71a385897af92ccb092f2f969b5709afab85a -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- src/Plugins/Wti/Wti.Controller/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) +++ src/Plugins/Wti/Wti.Controller/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -[assembly: AssemblyTitle("Wti.Controller")] -[assembly: AssemblyProduct("Wti.Controller")] -[assembly: Guid("3ad44406-356a-4ad1-b911-510da20d5430")] -[assembly: InternalsVisibleTo("Wti.Controller.Test")] \ No newline at end of file +[assembly: AssemblyTitle("Wti.Service")] +[assembly: AssemblyProduct("Wti.Service")] +[assembly: Guid("3ad44406-356a-4ad1-b911-510da20d5430")] \ No newline at end of file Index: src/Plugins/Wti/Wti.Controller/Properties/Resources.Designer.cs =================================================================== diff -u --- src/Plugins/Wti/Wti.Controller/Properties/Resources.Designer.cs (revision 0) +++ src/Plugins/Wti/Wti.Controller/Properties/Resources.Designer.cs (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.34209 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Wti.Service.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.Service.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 Piping berekening niet gelukt: {0}. + /// + internal static string ErrorInPipingCalculation_0 { + get { + return ResourceManager.GetString("ErrorInPipingCalculation_0", resourceCulture); + } + } + } +} Index: src/Plugins/Wti/Wti.Controller/Properties/Resources.resx =================================================================== diff -u --- src/Plugins/Wti/Wti.Controller/Properties/Resources.resx (revision 0) +++ src/Plugins/Wti/Wti.Controller/Properties/Resources.resx (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Piping berekening niet gelukt: {0} + + \ No newline at end of file Fisheye: Tag f4f20297137850e94b8ae0d8c582aec872d8c707 refers to a dead (removed) revision in file `src/Plugins/Wti/Wti.Controller/Wti.Controller.csproj'. Fisheye: No comparison available. Pass `N' to diff? Index: src/Plugins/Wti/Wti.Controller/Wti.Service.csproj =================================================================== diff -u --- src/Plugins/Wti/Wti.Controller/Wti.Service.csproj (revision 0) +++ src/Plugins/Wti/Wti.Controller/Wti.Service.csproj (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -0,0 +1,105 @@ + + + + + Debug + AnyCPU + {10B8D63D-87E8-46DF-ACA9-A8CF22EE8FB5} + Library + Properties + Wti.Service + Wti.Service + v4.0 + 512 + + + true + bin\Debug\ + DEBUG;TRACE + full + x86 + false + prompt + MinimumRecommendedRules.ruleset + + + bin\Release\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + + + + False + ..\..\..\..\lib\log4net.dll + + + + + + + + + + + + + + Properties\GlobalAssembly.cs + + + + + True + True + Resources.resx + + + + + {3DBD23CE-5C4A-4A49-B51C-B268CB2B510E} + DelftTools.Controls.Swf + + + {9A2D67E6-26AC-4D17-B11A-2B4372F2F572} + DelftTools.Controls + + + {82b61d20-fd4b-49be-9252-5bf6e3ee4666} + DelftTools.Shell.Core + + + {c90b77da-e421-43cc-b82e-529651bc21ac} + Wti.Base + + + {D64E4F0E-E341-496F-82B2-941AD202B4E3} + Wti.Calculation + + + {CE994CC9-6F6A-48AC-B4BE-02C30A21F4DB} + Wti.Data + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + \ No newline at end of file Index: src/Plugins/Wti/Wti.Forms/NodePresenters/PipingContextMenuStrip.cs =================================================================== diff -u --- src/Plugins/Wti/Wti.Forms/NodePresenters/PipingContextMenuStrip.cs (revision 0) +++ src/Plugins/Wti/Wti.Forms/NodePresenters/PipingContextMenuStrip.cs (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -0,0 +1,37 @@ +using System; +using System.Windows.Forms; +using Wti.Data; +using Wti.Forms.Properties; + +namespace Wti.Controller +{ + internal class PipingContextMenuStrip : ContextMenuStrip + { + public Action OnCalculationClick; + private readonly PipingData pipingData; + + public PipingContextMenuStrip(PipingData pipingData) + { + this.pipingData = pipingData; + var calculateItem = new ToolStripMenuItem(Resources.PipingDataContextMenuCalculate); + calculateItem.Click += CalculateItemClick; + Items.Add(calculateItem); + } + + public override sealed ToolStripItemCollection Items + { + get + { + return base.Items; + } + } + + private void CalculateItemClick(object sender, EventArgs e) + { + if (OnCalculationClick != null) + { + OnCalculationClick(pipingData); + } + } + } +} \ No newline at end of file Index: src/Plugins/Wti/Wti.Forms/NodePresenters/PipingDataNodePresenter.cs =================================================================== diff -u -r5fc71a385897af92ccb092f2f969b5709afab85a -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- src/Plugins/Wti/Wti.Forms/NodePresenters/PipingDataNodePresenter.cs (.../PipingDataNodePresenter.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) +++ src/Plugins/Wti/Wti.Forms/NodePresenters/PipingDataNodePresenter.cs (.../PipingDataNodePresenter.cs) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -2,9 +2,12 @@ using System.Collections; using System.ComponentModel; using DelftTools.Controls; +using DelftTools.Controls.Swf; using DelftTools.Utils.Collections; +using Wti.Controller; using Wti.Data; using Wti.Forms.Properties; +using Wti.Service; namespace Wti.Forms.NodePresenters { @@ -72,9 +75,19 @@ public IMenuItem GetContextMenu(ITreeNode sender, object nodeData) { - return ContextMenu(nodeData); + var contextMenu = new PipingContextMenuStrip((PipingData)nodeData); + var contextMenuAdapter = new MenuItemContextMenuStripAdapter(contextMenu); + + contextMenu.OnCalculationClick += PerformPipingCalculation; + + return contextMenuAdapter; } + private void PerformPipingCalculation(PipingData pipingData) + { + PipingCalculationService.Calculate(pipingData); + } + public void OnPropertyChanged(object sender, ITreeNode node, PropertyChangedEventArgs e) {} public void OnCollectionChanged(object sender, NotifyCollectionChangingEventArgs e) {} Index: src/Plugins/Wti/Wti.Forms/Properties/AssemblyInfo.cs =================================================================== diff -u -r5fc71a385897af92ccb092f2f969b5709afab85a -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- src/Plugins/Wti/Wti.Forms/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) +++ src/Plugins/Wti/Wti.Forms/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -1,6 +1,8 @@ using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Wti.Forms")] [assembly: AssemblyProduct("Wti.Forms")] -[assembly: Guid("97bf528a-7e74-41c1-a382-43fd5c521bfa")] \ No newline at end of file +[assembly: Guid("97bf528a-7e74-41c1-a382-43fd5c521bfa")] +[assembly: InternalsVisibleTo("Wti.Forms.Test")] \ No newline at end of file Index: src/Plugins/Wti/Wti.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -rb08cd825acc24d8d7b0f5e802bf65efece7ee4be -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- src/Plugins/Wti/Wti.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be) +++ src/Plugins/Wti/Wti.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 +// Runtime Version:4.0.30319.34209 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -70,15 +70,6 @@ } /// - /// Looks up a localized string similar to Piping berekening niet gelukt: {0}. - /// - public static string ErrorInPipingCalculation_0 { - get { - return ResourceManager.GetString("ErrorInPipingCalculation_0", resourceCulture); - } - } - - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap folder { Index: src/Plugins/Wti/Wti.Forms/Properties/Resources.resx =================================================================== diff -u -rb08cd825acc24d8d7b0f5e802bf65efece7ee4be -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- src/Plugins/Wti/Wti.Forms/Properties/Resources.resx (.../Resources.resx) (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be) +++ src/Plugins/Wti/Wti.Forms/Properties/Resources.resx (.../Resources.resx) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -120,9 +120,6 @@ Algemeen - - Piping berekening niet gelukt: {0} - ..\Resources\folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Index: src/Plugins/Wti/Wti.Forms/Wti.Forms.csproj =================================================================== diff -u -rb08cd825acc24d8d7b0f5e802bf65efece7ee4be -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- src/Plugins/Wti/Wti.Forms/Wti.Forms.csproj (.../Wti.Forms.csproj) (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be) +++ src/Plugins/Wti/Wti.Forms/Wti.Forms.csproj (.../Wti.Forms.csproj) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -41,6 +41,9 @@ Properties\GlobalAssembly.cs + + Component + @@ -85,6 +88,10 @@ {D64E4F0E-E341-496F-82B2-941AD202B4E3} Wti.Calculation + + {10B8D63D-87E8-46DF-ACA9-A8CF22EE8FB5} + Wti.Service + {ce994cc9-6f6a-48ac-b4be-02c30a21f4db} Wti.Data Index: src/Plugins/Wti/Wti.Plugin/Wti.Plugin.csproj =================================================================== diff -u -rb9fb2479ca915755aa087e7898b9a78eb1e4f0c0 -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- src/Plugins/Wti/Wti.Plugin/Wti.Plugin.csproj (.../Wti.Plugin.csproj) (revision b9fb2479ca915755aa087e7898b9a78eb1e4f0c0) +++ src/Plugins/Wti/Wti.Plugin/Wti.Plugin.csproj (.../Wti.Plugin.csproj) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -97,9 +97,9 @@ {d64e4f0e-e341-496f-82b2-941ad202b4e3} Wti.Calculation - + {10B8D63D-87E8-46DF-ACA9-A8CF22EE8FB5} - Wti.Controller + Wti.Service {ce994cc9-6f6a-48ac-b4be-02c30a21f4db} Index: src/Plugins/Wti/Wti.Plugin/WtiGuiPlugin.cs =================================================================== diff -u -r5fc71a385897af92ccb092f2f969b5709afab85a -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- src/Plugins/Wti/Wti.Plugin/WtiGuiPlugin.cs (.../WtiGuiPlugin.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) +++ src/Plugins/Wti/Wti.Plugin/WtiGuiPlugin.cs (.../WtiGuiPlugin.cs) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -73,7 +73,7 @@ public override IEnumerable GetProjectTreeViewNodePresenters() { yield return new WtiProjectNodePresenter(); - yield return new PipingDataNodeController().NodePresenter; + yield return new PipingDataNodePresenter(); yield return new PipingOutputNodePresenter(); } } Index: src/documentation/UML/UML.csproj =================================================================== diff -u -rb9fb2479ca915755aa087e7898b9a78eb1e4f0c0 -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- src/documentation/UML/UML.csproj (.../UML.csproj) (revision b9fb2479ca915755aa087e7898b9a78eb1e4f0c0) +++ src/documentation/UML/UML.csproj (.../UML.csproj) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -60,9 +60,9 @@ {d64e4f0e-e341-496f-82b2-941ad202b4e3} Wti.Calculation - + {10b8d63d-87e8-46df-aca9-a8cf22ee8fb5} - Wti.Controller + Wti.Service {ce994cc9-6f6a-48ac-b4be-02c30a21f4db} Index: test/Plugins/Wti/Wti.Controller.Test/PipingCalculationServiceTest.cs =================================================================== diff -u --- test/Plugins/Wti/Wti.Controller.Test/PipingCalculationServiceTest.cs (revision 0) +++ test/Plugins/Wti/Wti.Controller.Test/PipingCalculationServiceTest.cs (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -0,0 +1,58 @@ +using NUnit.Framework; +using Wti.Calculation.Piping; +using Wti.Data; + +namespace Wti.Service.Test +{ + public class PipingCalculationServiceTest + { + private readonly PipingData validPipingData = new PipingData + { + AssessmentLevel = 1.0, + BeddingAngle = 1.0, + CriticalHeaveGradient = 1.0, + DampingFactorExit = 1.0, + DarcyPermeability = 1.0, + Diameter70 = 1.0, + ExitPointXCoordinate = 1.0, + Gravity = 1.0, + MeanDiameter70 = 1.0, + PiezometricHeadExit = 1.0, + PiezometricHeadPolder = 1.0, + PhreaticLevelExit = 2.0, + SandParticlesVolumicWeight = 1.0, + SeepageLength = 1.0, + SellmeijerModelFactor = 1.0, + SellmeijerReductionFactor = 1.0, + ThicknessAquiferLayer = 1.0, + ThicknessCoverageLayer = 1.0, + UpliftModelFactor = 1.0, + WaterKinematicViscosity = 1.0, + WaterVolumetricWeight = 1.0, + WhitesDragCoefficient = 1.0 + }; + + [Test] + public void Calculate_ValidPipingData_ShouldSetOutput() + { + // Call + PipingCalculationService.Calculate(validPipingData); + + // Assert + Assert.NotNull(validPipingData.Output); + } + + [Test] + public void Calculate_InValidPipingData_ThrowsException() + { + // Setup + var invalidPipingData = new PipingData(); + + // Call + TestDelegate testDelegate = () => PipingCalculationService.Calculate(invalidPipingData); + + // Assert + Assert.Throws(testDelegate); + } + } +} \ No newline at end of file Fisheye: Tag f4f20297137850e94b8ae0d8c582aec872d8c707 refers to a dead (removed) revision in file `test/Plugins/Wti/Wti.Controller.Test/PipingContextMenuStripTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f4f20297137850e94b8ae0d8c582aec872d8c707 refers to a dead (removed) revision in file `test/Plugins/Wti/Wti.Controller.Test/PipingDataNodeControllerTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: test/Plugins/Wti/Wti.Controller.Test/Properties/AssemblyInfo.cs =================================================================== diff -u -r5fc71a385897af92ccb092f2f969b5709afab85a -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- test/Plugins/Wti/Wti.Controller.Test/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) +++ test/Plugins/Wti/Wti.Controller.Test/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -5,11 +5,11 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Wti.Controller.Test")] +[assembly: AssemblyTitle("Wti.Service.Test")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Wti.Controller.Test")] +[assembly: AssemblyProduct("Wti.Service.Test")] [assembly: AssemblyCopyright("Copyright © Microsoft 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] Fisheye: Tag f4f20297137850e94b8ae0d8c582aec872d8c707 refers to a dead (removed) revision in file `test/Plugins/Wti/Wti.Controller.Test/Wti.Controller.Test.csproj'. Fisheye: No comparison available. Pass `N' to diff? Index: test/Plugins/Wti/Wti.Controller.Test/Wti.Service.Test.csproj =================================================================== diff -u --- test/Plugins/Wti/Wti.Controller.Test/Wti.Service.Test.csproj (revision 0) +++ test/Plugins/Wti/Wti.Controller.Test/Wti.Service.Test.csproj (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {D783543B-46A1-4848-A812-AF5A5259ED7E} + Library + Properties + Wti.Service.Test + Wti.Service.Test + v4.0 + 512 + + + true + bin\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\Release\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + + + + ..\..\..\..\lib\nunit.framework.dll + + + + + + + + + + + + + + + + + {3DBD23CE-5C4A-4A49-B51C-B268CB2B510E} + DelftTools.Controls.Swf + + + {9A2D67E6-26AC-4D17-B11A-2B4372F2F572} + DelftTools.Controls + + + {82b61d20-fd4b-49be-9252-5bf6e3ee4666} + DelftTools.Shell.Core + + + {D64E4F0E-E341-496F-82B2-941AD202B4E3} + Wti.Calculation + + + {10B8D63D-87E8-46DF-ACA9-A8CF22EE8FB5} + Wti.Service + + + {CE994CC9-6F6A-48AC-B4BE-02C30A21F4DB} + Wti.Data + + + {7cd038e1-e111-4969-aced-22c5bd2974e1} + Wti.Forms + + + + + \ No newline at end of file Index: test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingDataNodePresenterTest.cs =================================================================== diff -u -r893ead4c5aa34d9e3c27688d0851f4064f9b38b6 -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingDataNodePresenterTest.cs (.../PipingDataNodePresenterTest.cs) (revision 893ead4c5aa34d9e3c27688d0851f4064f9b38b6) +++ test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingDataNodePresenterTest.cs (.../PipingDataNodePresenterTest.cs) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -244,45 +244,22 @@ } [Test] - public void GetContextMenu_NoContextMenuFunctionSet_ThrowsNullReferenceException() + public void GetContextMenu_ContextMenuFunctionSet_CallsContextMenuFunction() { // Setup var mocks = new MockRepository(); var nodeMock = mocks.StrictMock(); - var dataMock = mocks.StrictMock(); - mocks.ReplayAll(); + var dataMock = mocks.StrictMock(); var nodePresenter = new PipingDataNodePresenter(); - // Call - TestDelegate contextMenu = () => nodePresenter.GetContextMenu(nodeMock, dataMock); - - // Assert - Assert.Throws(contextMenu); - mocks.VerifyAll(); // Expect no calls on arguments - } - - [Test] - public void GetContextMenu_ContextMenuFunctionSet_CallsContextMenuFunction() - { - // Setup - var mocks = new MockRepository(); - var nodeMock = mocks.StrictMock(); - var dataMock = mocks.StrictMock(); - var testContext = mocks.StrictMock(); - mocks.ReplayAll(); - var nodePresenter = new PipingDataNodePresenter - { - ContextMenu = a => testContext - }; - // Call var contextMenu = nodePresenter.GetContextMenu(nodeMock, dataMock); // Assert - Assert.AreSame(testContext, contextMenu); + Assert.NotNull(contextMenu); mocks.VerifyAll(); // Expect no calls on arguments } Index: test/Plugins/Wti/Wti.Forms.Test/PipingContextMenuStripTest.cs =================================================================== diff -u --- test/Plugins/Wti/Wti.Forms.Test/PipingContextMenuStripTest.cs (revision 0) +++ test/Plugins/Wti/Wti.Forms.Test/PipingContextMenuStripTest.cs (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -0,0 +1,32 @@ +using NUnit.Framework; +using Wti.Controller; + +namespace Wti.Forms.Test +{ + public class PipingContextMenuStripTest + { + [Test] + public void GivenPipingContextMenu_WhenConstructedBasedOnAnything_ThenOneMenuItemIsAdded() + { + var actual = new PipingContextMenuStrip(null); + CollectionAssert.AllItemsAreNotNull(actual.Items); + } + + [Test] + public void GivenPipingContextMenuWithoutHandlers_WhenClickingCalculateMenuItem_NoExceptions() + { + var pipingContextMenu = new PipingContextMenuStrip(null); + pipingContextMenu.Items[0].PerformClick(); + } + + [Test] + public void GivenPipingContextMenuWithCalculateHandler_WhenClickingCalculateMenuItem_ActionIsExecuted() + { + var executed = false; + var pipingContextMenu = new PipingContextMenuStrip(null); + pipingContextMenu.OnCalculationClick += p => executed = true; + pipingContextMenu.Items[0].PerformClick(); + Assert.That(executed, Is.True); + } + } +} \ No newline at end of file Index: test/Plugins/Wti/Wti.Forms.Test/Wti.Forms.Test.csproj =================================================================== diff -u -rb08cd825acc24d8d7b0f5e802bf65efece7ee4be -rf4f20297137850e94b8ae0d8c582aec872d8c707 --- test/Plugins/Wti/Wti.Forms.Test/Wti.Forms.Test.csproj (.../Wti.Forms.Test.csproj) (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be) +++ test/Plugins/Wti/Wti.Forms.Test/Wti.Forms.Test.csproj (.../Wti.Forms.Test.csproj) (revision f4f20297137850e94b8ae0d8c582aec872d8c707) @@ -40,13 +40,15 @@ + +