Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs
===================================================================
diff -u -r26f527fb809a2325c8f883ece9da01a8f8040eb3 -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs (.../AddNewDemoAssessmentSectionCommand.cs) (revision 26f527fb809a2325c8f883ece9da01a8f8040eb3)
+++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs (.../AddNewDemoAssessmentSectionCommand.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -596,7 +596,7 @@
pipingFailureMechanism.StochasticSoilModels,
Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "DR6.soil"),
new ImportMessageProvider(),
- StochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(pipingFailureMechanism));
+ PipingStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(pipingFailureMechanism));
soilProfilesImporter.Import();
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataImportHelper.cs
===================================================================
diff -u -r78382ec129ddc7537096860680cef36f3796700d -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataImportHelper.cs (.../DataImportHelper.cs) (revision 78382ec129ddc7537096860680cef36f3796700d)
+++ Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataImportHelper.cs (.../DataImportHelper.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -225,7 +225,7 @@
assessmentSection.PipingFailureMechanism.StochasticSoilModels,
filePath,
new ImportMessageProvider(),
- StochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(assessmentSection.PipingFailureMechanism)),
+ PipingStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(assessmentSection.PipingFailureMechanism)),
"StochasticSoilModelImporter");
activity.Run();
activity.Finish();
Index: Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataUpdateHelper.cs
===================================================================
diff -u -r78382ec129ddc7537096860680cef36f3796700d -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataUpdateHelper.cs (.../DataUpdateHelper.cs) (revision 78382ec129ddc7537096860680cef36f3796700d)
+++ Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataUpdateHelper.cs (.../DataUpdateHelper.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -61,7 +61,7 @@
assessmentSection.PipingFailureMechanism.StochasticSoilModels,
filePath,
new UpdateMessageProvider(),
- StochasticSoilModelImporterConfigurationFactory.CreateUpdateStrategyConfiguration(assessmentSection.PipingFailureMechanism)),
+ PipingStochasticSoilModelImporterConfigurationFactory.CreateUpdateStrategyConfiguration(assessmentSection.PipingFailureMechanism)),
"StochasticSoilModelUpdater");
activity.Run();
activity.Finish();
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PresentationObjects/PipingStochasticSoilModelCollectionContext.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PresentationObjects/PipingStochasticSoilModelCollectionContext.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PresentationObjects/PipingStochasticSoilModelCollectionContext.cs (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -0,0 +1,71 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Core.Common.Controls.PresentationObjects;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Data.SoilProfile;
+
+namespace Ringtoets.Piping.Forms.PresentationObjects
+{
+ ///
+ /// The presentation object for .
+ ///
+ public class PipingStochasticSoilModelCollectionContext : ObservableWrappedObjectContextBase
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The stochastic soil models to wrap.
+ /// The failure mechanism.
+ /// The assessment section.
+ /// Thrown when any input argument is null.
+ public PipingStochasticSoilModelCollectionContext(PipingStochasticSoilModelCollection wrappedStochasticSoilModels,
+ PipingFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
+ : base(wrappedStochasticSoilModels)
+ {
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ FailureMechanism = failureMechanism;
+ AssessmentSection = assessmentSection;
+ }
+
+ ///
+ /// Gets the failure mechanism which the context belongs to.
+ ///
+ public PipingFailureMechanism FailureMechanism { get; }
+
+ ///
+ /// Gets the assessment section which the context belongs to.
+ ///
+ public IAssessmentSection AssessmentSection { get; }
+ }
+}
\ No newline at end of file
Fisheye: Tag 09693d79085118c47709b7059ab7c1ef459ad2aa refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Forms/PresentationObjects/StochasticSoilModelCollectionContext.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj
===================================================================
diff -u -r26f527fb809a2325c8f883ece9da01a8f8040eb3 -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 26f527fb809a2325c8f883ece9da01a8f8040eb3)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -58,7 +58,7 @@
-
+
True
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilLayerTransformer.cs
===================================================================
diff -u -rdaa6b36fc2506683c50ba4117790452ae4f45d7f -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilLayerTransformer.cs (.../PipingSoilLayerTransformer.cs) (revision daa6b36fc2506683c50ba4117790452ae4f45d7f)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilLayerTransformer.cs (.../PipingSoilLayerTransformer.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -34,10 +34,10 @@
///
/// Transforms generic into .
///
- public static class PipingSoilLayerTransformer
+ internal static class PipingSoilLayerTransformer
{
///
- /// Transforms the generic into a mechanism specific
+ /// Transforms the generic into a piping specific
/// soil profile of type .
///
/// The soil layer to use in the transformation.
@@ -157,7 +157,8 @@
private static void ValidateIsNonShiftedLogNormal(long? distribution, double shift, string incorrectDistibutionParameter)
{
- if (distribution.HasValue && (distribution != SoilLayerConstants.LogNormalDistributionValue || shift != 0.0))
+ if (distribution.HasValue && (distribution.Value != SoilLayerConstants.LogNormalDistributionValue
+ || Math.Abs(shift) > 1e-6))
{
throw new ImportedDataTransformException(string.Format(
Resources.SoilLayer_Stochastic_parameter_0_has_no_lognormal_distribution,
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilProfileTransformer.cs
===================================================================
diff -u -rdaa6b36fc2506683c50ba4117790452ae4f45d7f -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilProfileTransformer.cs (.../PipingSoilProfileTransformer.cs) (revision daa6b36fc2506683c50ba4117790452ae4f45d7f)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilProfileTransformer.cs (.../PipingSoilProfileTransformer.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -32,10 +32,10 @@
///
/// Transforms generic into .
///
- public static class PipingSoilProfileTransformer
+ internal static class PipingSoilProfileTransformer
{
///
- /// Transforms the generic into a mechanism specific
+ /// Transforms the generic into a piping specific
/// soil profile of type .
///
/// The soil profile to use in the transformation.
@@ -76,7 +76,7 @@
/// The created .
/// Thrown when:
///
- /// - The can not be used to determine intersections with;
+ /// - The cannot be used to determine intersections with;
/// - Transforming the failed.
///
///
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingStochasticSoilModelTransformer.cs
===================================================================
diff -u -rab481580593706295cd3af50672dc394ce5fe3ee -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingStochasticSoilModelTransformer.cs (.../PipingStochasticSoilModelTransformer.cs) (revision ab481580593706295cd3af50672dc394ce5fe3ee)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingStochasticSoilModelTransformer.cs (.../PipingStochasticSoilModelTransformer.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -52,12 +52,10 @@
throw new ImportedDataTransformException(message);
}
- IEnumerable pipingStochasticSoilProfiles = TransformStochasticSoilProfiles(
- stochasticSoilModel.StochasticSoilProfiles);
-
var pipingModel = new PipingStochasticSoilModel(stochasticSoilModel.Name);
pipingModel.Geometry.AddRange(stochasticSoilModel.Geometry);
- pipingModel.StochasticSoilProfiles.AddRange(pipingStochasticSoilProfiles.ToArray());
+ pipingModel.StochasticSoilProfiles.AddRange(
+ TransformStochasticSoilProfiles(stochasticSoilModel.StochasticSoilProfiles).ToArray());
return pipingModel;
}
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingStochasticSoilProfileTransformer.cs
===================================================================
diff -u -rdaa6b36fc2506683c50ba4117790452ae4f45d7f -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingStochasticSoilProfileTransformer.cs (.../PipingStochasticSoilProfileTransformer.cs) (revision daa6b36fc2506683c50ba4117790452ae4f45d7f)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingStochasticSoilProfileTransformer.cs (.../PipingStochasticSoilProfileTransformer.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -20,7 +20,6 @@
// All rights reserved.
using System;
-using Ringtoets.Common.IO.Exceptions;
using Ringtoets.Common.IO.SoilProfile;
using Ringtoets.Piping.Data.SoilProfile;
using Ringtoets.Piping.Primitives;
@@ -39,8 +38,6 @@
/// The transformed piping soil profile.
/// A new based on the given data.
/// Thrown when any of the input parameters is null.
- /// Thrown when transformation would not result
- /// in a valid transformed instance.
public static PipingStochasticSoilProfile Transform(StochasticSoilProfile stochasticSoilProfile, PipingSoilProfile soilProfile)
{
if (stochasticSoilProfile == null)
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingStochasticSoilModelImporterConfigurationFactory.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingStochasticSoilModelImporterConfigurationFactory.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingStochasticSoilModelImporterConfigurationFactory.cs (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -0,0 +1,64 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using Ringtoets.Common.IO.SoilProfile;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Data.SoilProfile;
+using Ringtoets.Piping.IO.SoilProfiles;
+
+namespace Ringtoets.Piping.Plugin.FileImporter
+{
+ ///
+ /// Factory for creating valid configurations for the .
+ ///
+ public static class PipingStochasticSoilModelImporterConfigurationFactory
+ {
+ ///
+ /// Creates a configuration to replace the current stochastic soil models on
+ /// with imported stochastic soil models.
+ ///
+ /// The failure mechanism to replace the stochastic soil models for.
+ /// The configuration for the replace operation.
+ public static StochasticSoilModelImporterConfiguration CreateReplaceStrategyConfiguration(
+ PipingFailureMechanism failureMechanism)
+ {
+ return new StochasticSoilModelImporterConfiguration(
+ new PipingStochasticSoilModelTransformer(),
+ new PipingStochasticSoilModelFilter(),
+ new PipingStochasticSoilModelReplaceDataStrategy(failureMechanism));
+ }
+
+ ///
+ /// Creates a configuration to update the current stochastic soil models on
+ /// with imported stochastic soil models.
+ ///
+ /// The failure mechanism to update the stochastic soil models for.
+ /// The configuration for the update operation.
+ public static StochasticSoilModelImporterConfiguration CreateUpdateStrategyConfiguration(
+ PipingFailureMechanism failureMechanism)
+ {
+ return new StochasticSoilModelImporterConfiguration(
+ new PipingStochasticSoilModelTransformer(),
+ new PipingStochasticSoilModelFilter(),
+ new PipingStochasticSoilModelUpdateDataStrategy(failureMechanism));
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 09693d79085118c47709b7059ab7c1ef459ad2aa refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/StochasticSoilModelImporterConfigurationFactory.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs
===================================================================
diff -u -r3cf4d4c65cf2ce285bdeb71162cf3b0a79cb3742 -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 3cf4d4c65cf2ce285bdeb71162cf3b0a79cb3742)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -82,7 +82,7 @@
CreateInstance = context => new PipingSurfaceLineCollectionProperties(context.WrappedData)
};
yield return new PropertyInfo();
- yield return new PropertyInfo
+ yield return new PropertyInfo
{
CreateInstance = context => new PipingStochasticSoilModelCollectionProperties(context.WrappedData)
};
@@ -113,7 +113,7 @@
VerifyUpdates = context => VerifyPipingSurfaceLineUpdates(context, Resources.PipingPlugin_VerifyPipingSurfaceLineImport_When_importing_surface_lines_calculation_output_will_be_cleared_confirm)
};
- yield return new ImportInfo
+ yield return new ImportInfo
{
Name = RingtoetsCommonDataResources.StochasticSoilModelCollection_TypeDescriptor,
Category = RingtoetsCommonFormsResources.Ringtoets_Category,
@@ -124,7 +124,7 @@
context.WrappedData,
filePath,
new ImportMessageProvider(),
- StochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(context.FailureMechanism)
+ PipingStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(context.FailureMechanism)
),
VerifyUpdates = context => VerifyStochasticSoilModelUpdates(context, Resources.PipingPlugin_VerifyStochasticSoilModelImport_When_importing_StochasticSoilModels_calculation_output_will_be_cleared_confirm)
};
@@ -169,7 +169,7 @@
VerifyUpdates = context => VerifyPipingSurfaceLineUpdates(context, Resources.PipingPlugin_VerifyPipingSurfaceLineUpdates_When_updating_surface_lines_definitions_assigned_to_calculation_output_will_be_cleared_confirm)
};
- yield return new UpdateInfo
+ yield return new UpdateInfo
{
Name = RingtoetsCommonDataResources.StochasticSoilModelCollection_TypeDescriptor,
Category = RingtoetsCommonFormsResources.Ringtoets_Category,
@@ -181,7 +181,7 @@
context.WrappedData,
filePath,
new UpdateMessageProvider(),
- StochasticSoilModelImporterConfigurationFactory.CreateUpdateStrategyConfiguration(context.FailureMechanism)
+ PipingStochasticSoilModelImporterConfigurationFactory.CreateUpdateStrategyConfiguration(context.FailureMechanism)
),
VerifyUpdates = context => VerifyStochasticSoilModelUpdates(context, Resources.PipingPlugin_VerifyStochasticSoilModelUpdates_When_updating_StochasticSoilModel_definitions_assigned_to_calculation_output_will_be_cleared_confirm)
};
@@ -301,7 +301,7 @@
.Build()
};
- yield return new TreeNodeInfo
+ yield return new TreeNodeInfo
{
Text = stochasticSoilModelContext => RingtoetsCommonDataResources.StochasticSoilModelCollection_TypeDescriptor,
Image = stochasticSoilModelContext => RingtoetsCommonFormsResources.GeneralFolderIcon,
@@ -371,7 +371,7 @@
}
}
- private bool VerifyStochasticSoilModelUpdates(StochasticSoilModelCollectionContext context, string query)
+ private bool VerifyStochasticSoilModelUpdates(PipingStochasticSoilModelCollectionContext context, string query)
{
var changeHandler = new FailureMechanismCalculationChangeHandler(context.FailureMechanism,
query,
@@ -583,7 +583,7 @@
#region StochasticSoilModelCollectionContext TreeNodeInfo
- private ContextMenuStrip StochasticSoilModelCollectionContextContextMenuStrip(StochasticSoilModelCollectionContext nodeData, object parentData, TreeViewControl treeViewControl)
+ private ContextMenuStrip StochasticSoilModelCollectionContextContextMenuStrip(PipingStochasticSoilModelCollectionContext nodeData, object parentData, TreeViewControl treeViewControl)
{
return Gui.Get(nodeData, treeViewControl)
.AddImportItem()
@@ -686,7 +686,7 @@
{
new FailureMechanismSectionsContext(failureMechanism, assessmentSection),
new PipingSurfaceLinesContext(failureMechanism.SurfaceLines, failureMechanism, assessmentSection),
- new StochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection),
+ new PipingStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection),
failureMechanism.InputComments
};
}
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Ringtoets.Piping.Plugin.csproj
===================================================================
diff -u -r91cd4c9e69ae988486a04f3e897c4d7bf9cb9e7f -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Ringtoets.Piping.Plugin.csproj (.../Ringtoets.Piping.Plugin.csproj) (revision 91cd4c9e69ae988486a04f3e897c4d7bf9cb9e7f)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Ringtoets.Piping.Plugin.csproj (.../Ringtoets.Piping.Plugin.csproj) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -46,7 +46,7 @@
-
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/SoilProfile/PipingStochasticSoilProfileTest.cs
===================================================================
diff -u -r9162a6b006fbfb420db272291d01b330a9dc4bcf -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/SoilProfile/PipingStochasticSoilProfileTest.cs (.../PipingStochasticSoilProfileTest.cs) (revision 9162a6b006fbfb420db272291d01b330a9dc4bcf)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/SoilProfile/PipingStochasticSoilProfileTest.cs (.../PipingStochasticSoilProfileTest.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -84,7 +84,7 @@
}
[Test]
- public void Update_WithNullProfile_ThrowsArgumentNullException()
+ public void Update_SoilProfileNull_ThrowsArgumentNullException()
{
// Setup
var stochasticProfile = new PipingStochasticSoilProfile(0.0, PipingSoilProfileTestFactory.CreatePipingSoilProfile());
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingStochasticSoilModelCollectionContextTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingStochasticSoilModelCollectionContextTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingStochasticSoilModelCollectionContextTest.cs (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -0,0 +1,90 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Core.Common.Controls.PresentationObjects;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Data.SoilProfile;
+using Ringtoets.Piping.Forms.PresentationObjects;
+
+namespace Ringtoets.Piping.Forms.Test.PresentationObjects
+{
+ [TestFixture]
+ public class PipingStochasticSoilModelCollectionContextTest
+ {
+ [Test]
+ public void ParameteredConstructor_DefaultValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism();
+
+ // Call
+ var context = new PipingStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection);
+
+ // Assert
+ Assert.IsInstanceOf>(context);
+ Assert.AreSame(failureMechanism.StochasticSoilModels, context.WrappedData);
+ Assert.AreSame(failureMechanism, context.FailureMechanism);
+ Assert.AreSame(assessmentSection, context.AssessmentSection);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ParameteredConstructor_FailureMechanismNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var stochasticSoilModels = new PipingStochasticSoilModelCollection();
+
+ // Call
+ TestDelegate test = () => new PipingStochasticSoilModelCollectionContext(stochasticSoilModels, null, assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ParameteredConstructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new PipingFailureMechanism();
+
+ // Call
+ TestDelegate test = () => new PipingStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 09693d79085118c47709b7059ab7c1ef459ad2aa refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/StochasticSoilModelCollectionContextTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs
===================================================================
diff -u -r99f686f22091051a65ff1ee20abd68ffad713647 -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 99f686f22091051a65ff1ee20abd68ffad713647)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -342,7 +342,7 @@
Enumerable.Empty(),
failureMechanism,
assessmentSection);
-
+
// Call
var properties = new PipingInputContextProperties(context, handler);
@@ -726,7 +726,7 @@
// Call & Assert
SetPropertyAndVerifyNotifcationsForCalculation(properties => properties.UseAssessmentLevelManualInput = true,
- calculation);
+ calculation);
}
[Test]
@@ -934,7 +934,7 @@
}
};
var failureMechanism = new PipingFailureMechanism();
-
+
var context = new PipingInputContext(calculationItem.InputParameters,
calculationItem,
Enumerable.Empty(),
@@ -1094,10 +1094,10 @@
var calculationItem = new PipingCalculationScenario(new GeneralPipingInput())
{
- InputParameters =
- {
- HydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(50)
- }
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(50)
+ }
};
var failureMechanism = new PipingFailureMechanism();
@@ -1153,7 +1153,7 @@
}
};
var failureMechanism = new PipingFailureMechanism();
-
+
var context = new PipingInputContext(calculationItem.InputParameters,
calculationItem,
Enumerable.Empty(),
@@ -1196,7 +1196,7 @@
AssessmentLevel = (RoundedDouble) random.NextDouble()
}
};
- var failureMechanism = new PipingFailureMechanism();
+ var failureMechanism = new PipingFailureMechanism();
var context = new PipingInputContext(calculationItem.InputParameters,
calculationItem,
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingStochasticSoilModelCollectionPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingStochasticSoilModelCollectionPropertiesTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingStochasticSoilModelCollectionPropertiesTest.cs (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -0,0 +1,87 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.ComponentModel;
+using System.Linq;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Piping.Data.SoilProfile;
+using Ringtoets.Piping.Forms.PropertyClasses;
+
+namespace Ringtoets.Piping.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class PipingStochasticSoilModelCollectionPropertiesTest
+ {
+ [Test]
+ public void Constructor_WithoutCollection_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new PipingStochasticSoilModelCollectionProperties(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("collection", paramName);
+ }
+
+ [Test]
+ public void Constructor_WithData_ReturnExpectedValues()
+ {
+ // Setup
+ const string someFilePath = "location/to/a/file";
+ var collection = new PipingStochasticSoilModelCollection();
+ collection.AddRange(Enumerable.Empty(), someFilePath);
+
+ // Call
+ var properties = new PipingStochasticSoilModelCollectionProperties(collection);
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.AreSame(collection, properties.Data);
+ Assert.AreEqual(someFilePath, properties.SourcePath);
+ }
+
+ [Test]
+ public void Constructor_WithData_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var collection = new PipingStochasticSoilModelCollection();
+
+ // Call
+ var properties = new PipingStochasticSoilModelCollectionProperties(collection);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(1, dynamicProperties.Count);
+
+ PropertyDescriptor stochasticSoilModelSourcePathProperty = dynamicProperties[0];
+ Assert.IsNotNull(stochasticSoilModelSourcePathProperty);
+ Assert.IsTrue(stochasticSoilModelSourcePathProperty.IsReadOnly);
+ Assert.AreEqual("Algemeen", stochasticSoilModelSourcePathProperty.Category);
+ Assert.AreEqual("Bronlocatie", stochasticSoilModelSourcePathProperty.DisplayName);
+ Assert.AreEqual(
+ "De locatie van het bestand waaruit de stochastische ondergrondmodellen zijn geïmporteerd.",
+ stochasticSoilModelSourcePathProperty.Description);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 09693d79085118c47709b7059ab7c1ef459ad2aa refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/StochasticSoilModelCollectionPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj
===================================================================
diff -u -r7b7bd75dc1c1327386c9be96b5d480565bb8ecd6 -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 7b7bd75dc1c1327386c9be96b5d480565bb8ecd6)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -67,7 +67,7 @@
-
+
@@ -77,7 +77,7 @@
-
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismResultViewTest.cs
===================================================================
diff -u -re25d4d9814eac847e4e004df35a91a938ee01912 -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismResultViewTest.cs (.../PipingFailureMechanismResultViewTest.cs) (revision e25d4d9814eac847e4e004df35a91a938ee01912)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismResultViewTest.cs (.../PipingFailureMechanismResultViewTest.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -249,7 +249,7 @@
// Setup
using (ShowFullyConfiguredFailureMechanismResultsView(new PipingFailureMechanism()))
{
- var dataGridView = (DataGridView)new ControlTester("dataGridView").TheObject;
+ var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
// Call
dataGridView.Rows[0].Cells[assessmentLayerThreeIndex].Value = newValue.ToString(CultureInfo.CurrentCulture);
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingStochasticSoilModelImporterConfigurationFactoryTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingStochasticSoilModelImporterConfigurationFactoryTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingStochasticSoilModelImporterConfigurationFactoryTest.cs (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -0,0 +1,83 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using NUnit.Framework;
+using Ringtoets.Common.IO.SoilProfile;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Data.SoilProfile;
+using Ringtoets.Piping.IO.SoilProfiles;
+using Ringtoets.Piping.Plugin.FileImporter;
+
+namespace Ringtoets.Piping.Plugin.Test.FileImporter
+{
+ [TestFixture]
+ public class PipingStochasticSoilModelImporterConfigurationFactoryTest
+ {
+ [Test]
+ public void CreateUpdateStrategyConfiguration_WithoutFailureMechanism_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => PipingStochasticSoilModelImporterConfigurationFactory.CreateUpdateStrategyConfiguration(null);
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void CreateUpdateStrategyConfiguration_ValidArgument_ReturnsUpdateStrategyAndTransformerForPiping()
+ {
+ // Call
+ StochasticSoilModelImporterConfiguration result =
+ PipingStochasticSoilModelImporterConfigurationFactory.CreateUpdateStrategyConfiguration(new PipingFailureMechanism());
+
+ // Assert
+ Assert.IsNotNull(result);
+ Assert.IsInstanceOf(result.Transformer);
+ Assert.IsInstanceOf(result.MechanismFilter);
+ Assert.IsInstanceOf(result.UpdateStrategy);
+ }
+
+ [Test]
+ public void CreateReplaceStrategyConfiguration_WithoutFailureMechanism_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => PipingStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(null);
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void CreateReplaceStrategyConfiguration_ValidArgument_ReturnsReplaceStrategyAndTransformerForPiping()
+ {
+ // Call
+ StochasticSoilModelImporterConfiguration result =
+ PipingStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(new PipingFailureMechanism());
+
+ // Assert
+ Assert.IsNotNull(result);
+ Assert.IsInstanceOf(result.Transformer);
+ Assert.IsInstanceOf(result.MechanismFilter);
+ Assert.IsInstanceOf(result.UpdateStrategy);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 09693d79085118c47709b7059ab7c1ef459ad2aa refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/StochasticSoilModelImporterConfigurationFactoryTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ImportInfos/PipingStochasticSoilModelCollectionContextImportInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ImportInfos/PipingStochasticSoilModelCollectionContextImportInfoTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ImportInfos/PipingStochasticSoilModelCollectionContextImportInfoTest.cs (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -0,0 +1,245 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Drawing;
+using System.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui;
+using Core.Common.Gui.Forms.MainWindow;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using Core.Common.Utils;
+using NUnit.Extensions.Forms;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.IO.SoilProfile;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Data.SoilProfile;
+using Ringtoets.Piping.Forms.PresentationObjects;
+using Ringtoets.Piping.KernelWrapper.TestUtil;
+using PipingFormsResources = Ringtoets.Piping.Forms.Properties.Resources;
+
+namespace Ringtoets.Piping.Plugin.Test.ImportInfos
+{
+ [TestFixture]
+ public class PipingStochasticSoilModelCollectionContextImportInfoTest : NUnitFormTest
+ {
+ private ImportInfo importInfo;
+ private PipingPlugin plugin;
+
+ [Test]
+ public void Name_Always_ReturnExpectedName()
+ {
+ // Call
+ string name = importInfo.Name;
+
+ // Assert
+ Assert.AreEqual("Stochastische ondergrondmodellen", name);
+ }
+
+ [Test]
+ public void Category_Always_ReturnExpectedCategory()
+ {
+ // Call
+ string category = importInfo.Category;
+
+ // Assert
+ Assert.AreEqual("Algemeen", category);
+ }
+
+ [Test]
+ public void Image_Always_ReturnExpectedIcon()
+ {
+ // Call
+ Image image = importInfo.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(PipingFormsResources.PipingSoilProfileIcon, image);
+ }
+
+ [Test]
+ public void IsEnabled_ReferenceLineNull_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism();
+
+ var context = new PipingStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void IsEnabled_ReferenceLineSet_ReturnTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ assessmentSection.ReferenceLine = new ReferenceLine();
+
+ var failureMechanism = new PipingFailureMechanism();
+
+ var context = new PipingStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void FileFilterGenerator_Always_ReturnExpectedFileFilter()
+ {
+ // Call
+ FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("D-Soil Model bestand (*.soil)|*.soil", fileFilterGenerator.Filter);
+ }
+
+ [Test]
+ public void VerifyUpdates_CalculationWithoutOutputs_ReturnsTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+
+ var mainWindow = mocks.Stub();
+ var gui = mocks.Stub();
+ gui.Stub(g => g.MainWindow).Return(mainWindow);
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+
+ var failureMechanism = new PipingFailureMechanism();
+ failureMechanism.CalculationsGroup.Children.Add(new PipingCalculationScenario(new GeneralPipingInput()));
+
+ var stochasticSoilModelCollection = new PipingStochasticSoilModelCollection();
+ var context = new PipingStochasticSoilModelCollectionContext(stochasticSoilModelCollection, failureMechanism, assessmentSection);
+
+ // Call
+ bool updatesVerified = importInfo.VerifyUpdates(context);
+
+ // Assert
+ Assert.IsTrue(updatesVerified);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void VerifyUpdates_CalculationWithOutputs_AlwaysReturnsExpectedInquiryMessage(bool isActionConfirmed)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+
+ var mainWindow = mocks.Stub();
+ var gui = mocks.Stub();
+ gui.Stub(g => g.MainWindow).Return(mainWindow);
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+
+ var failureMechanism = new PipingFailureMechanism();
+ var calculationWithOutput = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ Output = new TestPipingOutput()
+ };
+ failureMechanism.CalculationsGroup.Children.Add(calculationWithOutput);
+
+ var stochasticSoilModelCollection = new PipingStochasticSoilModelCollection();
+ var context = new PipingStochasticSoilModelCollectionContext(stochasticSoilModelCollection, failureMechanism, assessmentSection);
+
+ string textBoxMessage = null;
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var helper = new MessageBoxTester(wnd);
+ textBoxMessage = helper.Text;
+
+ if (isActionConfirmed)
+ {
+ helper.ClickOk();
+ }
+ else
+ {
+ helper.ClickCancel();
+ }
+ };
+
+ // Call
+ bool updatesVerified = importInfo.VerifyUpdates(context);
+
+ // Assert
+ string expectedInquiryMessage = "Als u stochastische ondergrondmodellen importeert, " +
+ "dan worden alle rekenresultaten van dit toetsspoor verwijderd." +
+ $"{Environment.NewLine}{Environment.NewLine}Weet u zeker dat u wilt doorgaan?";
+ Assert.AreEqual(expectedInquiryMessage, textBoxMessage);
+ Assert.AreEqual(isActionConfirmed, updatesVerified);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CreateFileImporter_Always_ReturnFileImporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism();
+
+ var importTarget = new PipingStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection);
+
+ // Call
+ IFileImporter importer = importInfo.CreateFileImporter(importTarget, "");
+
+ // Assert
+ Assert.IsInstanceOf>(importer);
+ mocks.VerifyAll();
+ }
+
+ public override void Setup()
+ {
+ plugin = new PipingPlugin();
+ importInfo = plugin.GetImportInfos().First(i => i.DataType == typeof(PipingStochasticSoilModelCollectionContext));
+ }
+
+ public override void TearDown()
+ {
+ plugin.Dispose();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 09693d79085118c47709b7059ab7c1ef459ad2aa refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ImportInfos/StochasticSoilModelCollectionContextImportInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingPluginTest.cs
===================================================================
diff -u -r26f527fb809a2325c8f883ece9da01a8f8040eb3 -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingPluginTest.cs (.../PipingPluginTest.cs) (revision 26f527fb809a2325c8f883ece9da01a8f8040eb3)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingPluginTest.cs (.../PipingPluginTest.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -91,7 +91,7 @@
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
- typeof(StochasticSoilModelCollectionContext),
+ typeof(PipingStochasticSoilModelCollectionContext),
typeof(PipingStochasticSoilModelCollectionProperties));
PluginTestHelper.AssertPropertyInfoDefined(
@@ -119,7 +119,7 @@
Assert.AreEqual(13, treeNodeInfos.Length);
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingSurfaceLinesContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingSurfaceLine)));
- Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StochasticSoilModelCollectionContext)));
+ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingStochasticSoilModelCollectionContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingStochasticSoilModel)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingStochasticSoilProfile)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingCalculationScenarioContext)));
@@ -188,7 +188,7 @@
// Assert
Assert.AreEqual(2, updateInfos.Length);
Assert.AreEqual(1, updateInfos.Count(updateInfo => updateInfo.DataType == typeof(PipingSurfaceLinesContext)));
- Assert.AreEqual(1, updateInfos.Count(updateInfo => updateInfo.DataType == typeof(StochasticSoilModelCollectionContext)));
+ Assert.AreEqual(1, updateInfos.Count(updateInfo => updateInfo.DataType == typeof(PipingStochasticSoilModelCollectionContext)));
}
}
@@ -204,7 +204,7 @@
// Assert
Assert.AreEqual(3, importInfos.Length);
Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(PipingSurfaceLinesContext)));
- Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(StochasticSoilModelCollectionContext)));
+ Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(PipingStochasticSoilModelCollectionContext)));
Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(PipingCalculationGroupContext)));
}
}
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PropertyInfos/PipingStochasticSoilModelCollectionContextPropertyInfoTest.cs
===================================================================
diff -u -r26f527fb809a2325c8f883ece9da01a8f8040eb3 -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PropertyInfos/PipingStochasticSoilModelCollectionContextPropertyInfoTest.cs (.../PipingStochasticSoilModelCollectionContextPropertyInfoTest.cs) (revision 26f527fb809a2325c8f883ece9da01a8f8040eb3)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PropertyInfos/PipingStochasticSoilModelCollectionContextPropertyInfoTest.cs (.../PipingStochasticSoilModelCollectionContextPropertyInfoTest.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -55,7 +55,7 @@
public void Initialized_Always_ExpectedPropertiesSet()
{
// Assert
- Assert.AreEqual(typeof(StochasticSoilModelCollectionContext), info.DataType);
+ Assert.AreEqual(typeof(PipingStochasticSoilModelCollectionContext), info.DataType);
Assert.AreEqual(typeof(PipingStochasticSoilModelCollectionProperties), info.PropertyObjectType);
}
@@ -70,7 +70,7 @@
var failureMechanism = new PipingFailureMechanism();
var collection = new PipingStochasticSoilModelCollection();
- var context = new StochasticSoilModelCollectionContext(collection, failureMechanism, assessmentSection);
+ var context = new PipingStochasticSoilModelCollectionContext(collection, failureMechanism, assessmentSection);
// Call
IObjectProperties objectProperties = info.CreateInstance(context);
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PropertyInfos/PipingStochasticSoilModelPropertyInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PropertyInfos/PipingStochasticSoilModelPropertyInfoTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PropertyInfos/PipingStochasticSoilModelPropertyInfoTest.cs (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -0,0 +1,72 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Linq;
+using Core.Common.Gui.Plugin;
+using Core.Common.Gui.PropertyBag;
+using NUnit.Framework;
+using Ringtoets.Piping.Data.SoilProfile;
+using Ringtoets.Piping.Forms.PropertyClasses;
+
+namespace Ringtoets.Piping.Plugin.Test.PropertyInfos
+{
+ [TestFixture]
+ public class PipingStochasticSoilModelPropertyInfoTest
+ {
+ private PipingPlugin plugin;
+ private PropertyInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ plugin = new PipingPlugin();
+ info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(PipingStochasticSoilModelProperties));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(PipingStochasticSoilModel), info.DataType);
+ Assert.AreEqual(typeof(PipingStochasticSoilModelProperties), info.PropertyObjectType);
+ }
+
+ [Test]
+ public void CreateInstance_Always_NewPropertiesWithInputAsData()
+ {
+ // Setup
+ var stochasticSoilModel = new PipingStochasticSoilModel("some name");
+
+ // Call
+ IObjectProperties objectProperties = info.CreateInstance(stochasticSoilModel);
+
+ // Assert
+ Assert.IsInstanceOf(objectProperties);
+ Assert.AreSame(stochasticSoilModel, objectProperties.Data);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PropertyInfos/PipingStochasticSoilProfilePropertyInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PropertyInfos/PipingStochasticSoilProfilePropertyInfoTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PropertyInfos/PipingStochasticSoilProfilePropertyInfoTest.cs (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -0,0 +1,73 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Linq;
+using Core.Common.Gui.Plugin;
+using Core.Common.Gui.PropertyBag;
+using NUnit.Framework;
+using Ringtoets.Piping.Data.SoilProfile;
+using Ringtoets.Piping.Forms.PropertyClasses;
+using Ringtoets.Piping.KernelWrapper.TestUtil;
+
+namespace Ringtoets.Piping.Plugin.Test.PropertyInfos
+{
+ [TestFixture]
+ public class PipingStochasticSoilProfilePropertyInfoTest
+ {
+ private PipingPlugin plugin;
+ private PropertyInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ plugin = new PipingPlugin();
+ info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(PipingStochasticSoilProfileProperties));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(PipingStochasticSoilProfile), info.DataType);
+ Assert.AreEqual(typeof(PipingStochasticSoilProfileProperties), info.PropertyObjectType);
+ }
+
+ [Test]
+ public void CreateInstance_Always_NewPropertiesWithInputAsData()
+ {
+ // Setup
+ var stochasticSoilProfile = new PipingStochasticSoilProfile(0.5, PipingSoilProfileTestFactory.CreatePipingSoilProfile());
+
+ // Call
+ IObjectProperties objectProperties = info.CreateInstance(stochasticSoilProfile);
+
+ // Assert
+ Assert.IsInstanceOf(objectProperties);
+ Assert.AreSame(stochasticSoilProfile, objectProperties.Data);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj
===================================================================
diff -u -r7b7bd75dc1c1327386c9be96b5d480565bb8ecd6 -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision 7b7bd75dc1c1327386c9be96b5d480565bb8ecd6)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -70,15 +70,17 @@
-
+
-
+
+
+
@@ -93,11 +95,11 @@
-
+
-
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs
===================================================================
diff -u -r5c0da60fa22b23e4c560df3ed0c76956f0e60f21 -r09693d79085118c47709b7059ab7c1ef459ad2aa
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs (.../PipingFailureMechanismContextTreeNodeInfoTest.cs) (revision 5c0da60fa22b23e4c560df3ed0c76956f0e60f21)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs (.../PipingFailureMechanismContextTreeNodeInfoTest.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -168,7 +168,7 @@
Assert.AreSame(pipingFailureMechanism, surfaceLinesContext.FailureMechanism);
Assert.AreSame(assessmentSection, surfaceLinesContext.AssessmentSection);
- var stochasticSoilModelContext = (StochasticSoilModelCollectionContext) inputsFolder.Contents[2];
+ var stochasticSoilModelContext = (PipingStochasticSoilModelCollectionContext) inputsFolder.Contents[2];
Assert.AreSame(pipingFailureMechanism, stochasticSoilModelContext.FailureMechanism);
Assert.AreSame(pipingFailureMechanism, stochasticSoilModelContext.FailureMechanism);
Assert.AreSame(assessmentSection, stochasticSoilModelContext.AssessmentSection);
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingStochasticSoilModelCollectionContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingStochasticSoilModelCollectionContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingStochasticSoilModelCollectionContextTreeNodeInfoTest.cs (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -0,0 +1,252 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Drawing;
+using System.Linq;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui;
+using Core.Common.Gui.ContextMenu;
+using Core.Common.TestUtil;
+using NUnit.Extensions.Forms;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Data.SoilProfile;
+using Ringtoets.Piping.Forms.PresentationObjects;
+using Ringtoets.Piping.KernelWrapper.TestUtil;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Piping.Plugin.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class PipingStochasticSoilModelCollectionContextTreeNodeInfoTest : NUnitFormTest
+ {
+ private MockRepository mocks;
+ private PipingPlugin plugin;
+ private TreeNodeInfo info;
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Assert
+ Assert.IsNotNull(info.Text);
+ Assert.IsNotNull(info.ForeColor);
+ Assert.IsNotNull(info.Image);
+ Assert.IsNotNull(info.ContextMenuStrip);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ExpandOnCreate);
+ Assert.IsNotNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+
+ [Test]
+ public void Text_Always_ReturnsTextFromResource()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism();
+
+ var stochasticSoilModelCollectionContext = new PipingStochasticSoilModelCollectionContext(
+ failureMechanism.StochasticSoilModels,
+ failureMechanism,
+ assessmentSection);
+
+ // Call
+ string text = info.Text(stochasticSoilModelCollectionContext);
+
+ // Assert
+ Assert.AreEqual("Stochastische ondergrondmodellen", text);
+ }
+
+ [Test]
+ public void Image_Always_ReturnsSetImage()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism();
+
+ var stochasticSoilModelCollectionContext = new PipingStochasticSoilModelCollectionContext(
+ failureMechanism.StochasticSoilModels,
+ failureMechanism,
+ assessmentSection);
+
+ // Call
+ Image image = info.Image(stochasticSoilModelCollectionContext);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralFolderIcon, image);
+ }
+
+ [Test]
+ public void ForeColor_CollectionWithoutSoilModels_ReturnsGrayText()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism();
+
+ var stochasticSoilModelCollectionContext = new PipingStochasticSoilModelCollectionContext(
+ failureMechanism.StochasticSoilModels,
+ failureMechanism,
+ assessmentSection);
+
+ // Call
+ Color foreColor = info.ForeColor(stochasticSoilModelCollectionContext);
+
+ // Assert
+ Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), foreColor);
+ }
+
+ [Test]
+ public void ForeColor_CollectionWithSoilModels_ReturnsControlText()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism();
+ failureMechanism.StochasticSoilModels.AddRange(new[]
+ {
+ new PipingStochasticSoilModel("Name")
+ }, "path");
+
+ var stochasticSoilModelCollectionContext = new PipingStochasticSoilModelCollectionContext(
+ failureMechanism.StochasticSoilModels,
+ failureMechanism,
+ assessmentSection);
+
+ // Call
+ Color foreColor = info.ForeColor(stochasticSoilModelCollectionContext);
+
+ // Assert
+ Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), foreColor);
+ }
+
+ [Test]
+ public void ChildNodeObjects_Always_ReturnsChildrenOfData()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var stochasticSoilModel = new PipingStochasticSoilModel("Name")
+ {
+ StochasticSoilProfiles =
+ {
+ new PipingStochasticSoilProfile(0.5, PipingSoilProfileTestFactory.CreatePipingSoilProfile()),
+ new PipingStochasticSoilProfile(0.5, PipingSoilProfileTestFactory.CreatePipingSoilProfile())
+ }
+ };
+
+ var failureMechanism = new PipingFailureMechanism();
+ var stochasticSoilModelCollectionContext = new PipingStochasticSoilModelCollectionContext(
+ failureMechanism.StochasticSoilModels,
+ failureMechanism,
+ assessmentSection);
+ failureMechanism.StochasticSoilModels.AddRange(new[]
+ {
+ stochasticSoilModel
+ }, "path");
+
+ // Call
+ object[] objects = info.ChildNodeObjects(stochasticSoilModelCollectionContext);
+
+ // Assert
+ CollectionAssert.AreEqual(new[]
+ {
+ stochasticSoilModel
+ }, objects);
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsBuilder()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+
+ var menuBuilder = mocks.StrictMock();
+ using (mocks.Ordered())
+ {
+ menuBuilder.Expect(mb => mb.AddImportItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddUpdateItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.Build()).Return(null);
+ }
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var context = new PipingStochasticSoilModelCollectionContext(
+ new PipingStochasticSoilModelCollection(),
+ new PipingFailureMechanism(),
+ assessmentSection);
+ var gui = mocks.Stub();
+
+ gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder);
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(context, null, treeViewControl);
+ }
+ // Assert
+ // Assert expectancies are called in TearDown()
+ }
+
+ public override void Setup()
+ {
+ mocks = new MockRepository();
+ plugin = new PipingPlugin();
+ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(PipingStochasticSoilModelCollectionContext));
+ }
+
+ public override void TearDown()
+ {
+ plugin.Dispose();
+ mocks.VerifyAll();
+
+ base.TearDown();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 09693d79085118c47709b7059ab7c1ef459ad2aa refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/StochasticSoilModelCollectionContextTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/UpdateInfos/PipingStochasticSoilModelCollectionContextUpdateInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/UpdateInfos/PipingStochasticSoilModelCollectionContextUpdateInfoTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/UpdateInfos/PipingStochasticSoilModelCollectionContextUpdateInfoTest.cs (revision 09693d79085118c47709b7059ab7c1ef459ad2aa)
@@ -0,0 +1,274 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Drawing;
+using System.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui;
+using Core.Common.Gui.Forms.MainWindow;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using Core.Common.Utils;
+using NUnit.Extensions.Forms;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.IO.SoilProfile;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Data.SoilProfile;
+using Ringtoets.Piping.Data.TestUtil;
+using Ringtoets.Piping.Forms.PresentationObjects;
+using Ringtoets.Piping.KernelWrapper.TestUtil;
+using PipingFormsResources = Ringtoets.Piping.Forms.Properties.Resources;
+
+namespace Ringtoets.Piping.Plugin.Test.UpdateInfos
+{
+ [TestFixture]
+ public class PipingStochasticSoilModelCollectionContextUpdateInfoTest : NUnitFormTest
+ {
+ private UpdateInfo updateInfo;
+ private PipingPlugin plugin;
+
+ [Test]
+ public void Name_Always_ReturnExpectedName()
+ {
+ // Call
+ string name = updateInfo.Name;
+
+ // Assert
+ Assert.AreEqual("Stochastische ondergrondmodellen", name);
+ }
+
+ [Test]
+ public void Category_Always_ReturnExpectedCategory()
+ {
+ // Call
+ string category = updateInfo.Category;
+
+ // Assert
+ Assert.AreEqual("Algemeen", category);
+ }
+
+ [Test]
+ public void Image_Always_ReturnExpectedIcon()
+ {
+ // Call
+ Image image = updateInfo.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(PipingFormsResources.PipingSoilProfileIcon, image);
+ }
+
+ [Test]
+ public void IsEnabled_SoilModelCollectionSourcePathNull_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism();
+ var stochasticSoilModel = new PipingStochasticSoilModelCollection();
+
+ var context = new PipingStochasticSoilModelCollectionContext(stochasticSoilModel, failureMechanism, assessmentSection);
+
+ // Call
+ bool isEnabled = updateInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void IsEnabled_SoilModelCollectionSourcePathSet_ReturnTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism();
+ var stochasticSoilModel = new PipingStochasticSoilModelCollection();
+ stochasticSoilModel.AddRange(Enumerable.Empty(), "some/path");
+
+ var context = new PipingStochasticSoilModelCollectionContext(stochasticSoilModel, failureMechanism, assessmentSection);
+
+ // Call
+ bool isEnabled = updateInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void FileFilterGenerator_Always_ReturnExpectedFileFilter()
+ {
+ // Call
+ FileFilterGenerator fileFilterGenerator = updateInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("D-Soil Model bestand (*.soil)|*.soil", fileFilterGenerator.Filter);
+ }
+
+ [Test]
+ public void VerifyUpdates_CalculationWithoutOutputs_ReturnsTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+
+ var mainWindow = mocks.Stub();
+ var gui = mocks.Stub();
+ gui.Stub(g => g.MainWindow).Return(mainWindow);
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+
+ var failureMechanism = new PipingFailureMechanism();
+ failureMechanism.CalculationsGroup.Children.Add(new PipingCalculationScenario(new GeneralPipingInput()));
+
+ var stochasticSoilModelCollection = new PipingStochasticSoilModelCollection();
+ var context = new PipingStochasticSoilModelCollectionContext(stochasticSoilModelCollection, failureMechanism, assessmentSection);
+
+ // Call
+ bool updatesVerified = updateInfo.VerifyUpdates(context);
+
+ // Assert
+ Assert.IsTrue(updatesVerified);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void VerifyUpdates_CalculationWithOutputs_AlwaysReturnsExpectedInquiryMessage(bool isActionConfirmed)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+
+ var mainWindow = mocks.Stub();
+ var gui = mocks.Stub();
+ gui.Stub(g => g.MainWindow).Return(mainWindow);
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+
+ var failureMechanism = new PipingFailureMechanism();
+ var calculationWithOutput = new PipingCalculationScenario(new GeneralPipingInput())
+ {
+ Output = new TestPipingOutput()
+ };
+ failureMechanism.CalculationsGroup.Children.Add(calculationWithOutput);
+
+ var stochasticSoilModelCollection = new PipingStochasticSoilModelCollection();
+ var context = new PipingStochasticSoilModelCollectionContext(stochasticSoilModelCollection, failureMechanism, assessmentSection);
+
+ string textBoxMessage = null;
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var helper = new MessageBoxTester(wnd);
+ textBoxMessage = helper.Text;
+
+ if (isActionConfirmed)
+ {
+ helper.ClickOk();
+ }
+ else
+ {
+ helper.ClickCancel();
+ }
+ };
+
+ // Call
+ bool updatesVerified = updateInfo.VerifyUpdates(context);
+
+ // Assert
+ string expectedInquiryMessage = "Als ondergrondschematisaties wijzigen door het bijwerken, " +
+ "dan worden de resultaten van berekeningen die deze ondergrondschematisaties gebruiken " +
+ $"verwijderd.{Environment.NewLine}{Environment.NewLine}Weet u zeker dat u wilt doorgaan?";
+ Assert.AreEqual(expectedInquiryMessage, textBoxMessage);
+ Assert.AreEqual(isActionConfirmed, updatesVerified);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CurrentPath_StochasticSoilModelCollectionHasPathSet_ReturnsExpectedPath()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ const string expectedFilePath = "some/path";
+ var stochasticSoilModelCollection = new PipingStochasticSoilModelCollection();
+ stochasticSoilModelCollection.AddRange(new[]
+ {
+ PipingStochasticSoilModelTestFactory.CreatePipingStochasticSoilModel()
+ }, expectedFilePath);
+
+ var failureMechanism = new PipingFailureMechanism();
+
+ var context = new PipingStochasticSoilModelCollectionContext(stochasticSoilModelCollection, failureMechanism, assessmentSection);
+
+ // Call
+ string currentPath = updateInfo.CurrentPath(context);
+
+ // Assert
+ Assert.AreEqual(expectedFilePath, currentPath);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CreateFileImporter_Always_ReturnFileImporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism();
+
+ var importTarget = new PipingStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection);
+
+ // Call
+ IFileImporter importer = updateInfo.CreateFileImporter(importTarget, "");
+
+ // Assert
+ Assert.IsInstanceOf>(importer);
+ mocks.VerifyAll();
+ }
+
+ public override void Setup()
+ {
+ plugin = new PipingPlugin();
+ updateInfo = plugin.GetUpdateInfos().First(i => i.DataType == typeof(PipingStochasticSoilModelCollectionContext));
+ }
+
+ public override void TearDown()
+ {
+ plugin.Dispose();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 09693d79085118c47709b7059ab7c1ef459ad2aa refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/UpdateInfos/StochasticSoilModelCollectionContextUpdateInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?