Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/FailureMechanismBaseCreateExtensions.cs =================================================================== diff -u -r35408ec0912670519b01cff44a19a3e2fb12d8d6 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/FailureMechanismBaseCreateExtensions.cs (.../FailureMechanismBaseCreateExtensions.cs) (revision 35408ec0912670519b01cff44a19a3e2fb12d8d6) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/FailureMechanismBaseCreateExtensions.cs (.../FailureMechanismBaseCreateExtensions.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -42,7 +42,7 @@ /// is null /// /// - internal static void AddEntitiesForFailureMechanismSections(this FailureMechanismBase mechanism, CreateConversionCollector collector, FailureMechanismEntity entity) + internal static void AddEntitiesForFailureMechanismSections(this IFailureMechanism mechanism, CreateConversionCollector collector, FailureMechanismEntity entity) { if (collector == null) { Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs =================================================================== diff -u -r60f9f8cfadfe1b22e5989aa92ab9839c4623338d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 60f9f8cfadfe1b22e5989aa92ab9839c4623338d) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -98,7 +98,7 @@ return failureMechanism; } - private static void ReadFailureMechanismSections(this FailureMechanismEntity entity, FailureMechanismBase failureMechanism) + private static void ReadFailureMechanismSections(this FailureMechanismEntity entity, IFailureMechanism failureMechanism) { foreach (var failureMechanismSectionEntity in entity.FailureMechanismSectionEntities) { Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/FailureMechanismBaseUpdateExtensions.cs =================================================================== diff -u -r35408ec0912670519b01cff44a19a3e2fb12d8d6 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/FailureMechanismBaseUpdateExtensions.cs (.../FailureMechanismBaseUpdateExtensions.cs) (revision 35408ec0912670519b01cff44a19a3e2fb12d8d6) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/FailureMechanismBaseUpdateExtensions.cs (.../FailureMechanismBaseUpdateExtensions.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -46,7 +46,7 @@ /// is null /// /// - internal static void UpdateFailureMechanismSections(this FailureMechanismBase mechanism, UpdateConversionCollector collector, FailureMechanismEntity entity, IRingtoetsEntities context) + internal static void UpdateFailureMechanismSections(this IFailureMechanism mechanism, UpdateConversionCollector collector, FailureMechanismEntity entity, IRingtoetsEntities context) { if (collector == null) { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ProjectUpdateExtensionsTest.cs =================================================================== diff -u -r246ebb0ea665a568e9073717d4211816220ff0fc -r64d5609bb2912cd52dc74deffdd189222e240599 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ProjectUpdateExtensionsTest.cs (.../ProjectUpdateExtensionsTest.cs) (revision 246ebb0ea665a568e9073717d4211816220ff0fc) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ProjectUpdateExtensionsTest.cs (.../ProjectUpdateExtensionsTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -200,7 +200,6 @@ mocks.ReplayAll(); - var newDescription = "newDescription"; var project = new Project { StorageId = 1, Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs =================================================================== diff -u -r4bb55feac151da4010e81849de3103327f7f40ae -r64d5609bb2912cd52dc74deffdd189222e240599 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs (.../RingtoetsEntitiesHelper.cs) (revision 4bb55feac151da4010e81849de3103327f7f40ae) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs (.../RingtoetsEntitiesHelper.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -20,7 +20,6 @@ // All rights reserved. using System.Collections.ObjectModel; -using System.Data.Entity; using Application.Ringtoets.Storage.DbContext; using Rhino.Mocks; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/SqLiteDatabaseHelper.cs =================================================================== diff -u -rbc9552772d4e6a6bd786dfcaef808da1964e8c53 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/SqLiteDatabaseHelper.cs (.../SqLiteDatabaseHelper.cs) (revision bc9552772d4e6a6bd786dfcaef808da1964e8c53) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/SqLiteDatabaseHelper.cs (.../SqLiteDatabaseHelper.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -20,10 +20,8 @@ // All rights reserved. using System; -using System.Data.Entity.Core.EntityClient; using System.Data.SQLite; using Core.Common.Base.Data; -using Core.Common.Base.Properties; using NUnit.Framework; namespace Application.Ringtoets.Storage.TestUtil Index: Core/Common/src/Core.Common.Base/IO/IFileImporter.cs =================================================================== diff -u -re04155c0cc0efa8bbd13e0a82cb8643711a2dfd6 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Core/Common/src/Core.Common.Base/IO/IFileImporter.cs (.../IFileImporter.cs) (revision e04155c0cc0efa8bbd13e0a82cb8643711a2dfd6) +++ Core/Common/src/Core.Common.Base/IO/IFileImporter.cs (.../IFileImporter.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -19,7 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using System.Drawing; namespace Core.Common.Base.IO Index: Core/Common/src/Core.Common.Gui/Commands/IProjectCommands.cs =================================================================== diff -u -ref1c61d94f2aec3b4ff32fcf03253d7ad386c8e5 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Core/Common/src/Core.Common.Gui/Commands/IProjectCommands.cs (.../IProjectCommands.cs) (revision ef1c61d94f2aec3b4ff32fcf03253d7ad386c8e5) +++ Core/Common/src/Core.Common.Gui/Commands/IProjectCommands.cs (.../IProjectCommands.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -19,9 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; -using System.Collections.Generic; - using Core.Common.Base.Data; namespace Core.Common.Gui.Commands Index: Core/Common/test/Core.Common.Gui.Test/Forms/MessageWindow/MessageWindowLogAppenderTest.cs =================================================================== diff -u -rfc38d18fc6ff1749476da0ea43281d5d80568283 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Core/Common/test/Core.Common.Gui.Test/Forms/MessageWindow/MessageWindowLogAppenderTest.cs (.../MessageWindowLogAppenderTest.cs) (revision fc38d18fc6ff1749476da0ea43281d5d80568283) +++ Core/Common/test/Core.Common.Gui.Test/Forms/MessageWindow/MessageWindowLogAppenderTest.cs (.../MessageWindowLogAppenderTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,7 +1,6 @@ using System; using System.Globalization; using Core.Common.Gui.Forms.MessageWindow; -using Core.Common.Gui.TestUtil; using Core.Common.TestUtil; using log4net.Core; using log4net.Util; Index: Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/GuiImportHandlerTest.cs =================================================================== diff -u -re8b38c279ab010c360bd6589c8600e9cf387b11f -r64d5609bb2912cd52dc74deffdd189222e240599 --- Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/GuiImportHandlerTest.cs (.../GuiImportHandlerTest.cs) (revision e8b38c279ab010c360bd6589c8600e9cf387b11f) +++ Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/GuiImportHandlerTest.cs (.../GuiImportHandlerTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,6 +1,5 @@ using System; using Core.Common.Base.Plugin; -using Core.Common.Gui; using Core.Common.Gui.Commands; using Core.Common.Gui.Forms.MainWindow; using NUnit.Extensions.Forms; Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/Properties/AssemblyInfo.cs =================================================================== diff -u -rae34e25064174cb82307bbd514ef3d37bf49586b -r64d5609bb2912cd52dc74deffdd189222e240599 --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision ae34e25064174cb82307bbd514ef3d37bf49586b) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following Index: Core/Components/test/Core.Components.Gis.Test/Properties/AssemblyInfo.cs =================================================================== diff -u -rf612f81e3d6435ddd1a9c571738aab54e6048a9e -r64d5609bb2912cd52dc74deffdd189222e240599 --- Core/Components/test/Core.Components.Gis.Test/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision f612f81e3d6435ddd1a9c571738aab54e6048a9e) +++ Core/Components/test/Core.Components.Gis.Test/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendController.cs =================================================================== diff -u -r6a644d66b282d1c0cb1625cf2322f1e67148556d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendController.cs (.../LegendController.cs) (revision 6a644d66b282d1c0cb1625cf2322f1e67148556d) +++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendController.cs (.../LegendController.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -23,7 +23,6 @@ using Core.Common.Controls.Views; using Core.Common.Gui; using Core.Components.Charting.Data; -using Core.Components.OxyPlot.Forms; namespace Core.Plugins.OxyPlot.Legend { Index: Core/Plugins/test/Core.Plugins.CommonTools.Test/Property/UrlPropertiesTest.cs =================================================================== diff -u -rf4a633bf7b75c0e25f0c5bcd600df6def184962c -r64d5609bb2912cd52dc74deffdd189222e240599 --- Core/Plugins/test/Core.Plugins.CommonTools.Test/Property/UrlPropertiesTest.cs (.../UrlPropertiesTest.cs) (revision f4a633bf7b75c0e25f0c5bcd600df6def184962c) +++ Core/Plugins/test/Core.Plugins.CommonTools.Test/Property/UrlPropertiesTest.cs (.../UrlPropertiesTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,6 +1,5 @@ using System; using System.ComponentModel; -using Core.Common.Gui; using Core.Common.Gui.PropertyBag; using Core.Common.Utils; using Core.Plugins.CommonTools.Property; Index: Demo/Ringtoets/src/Demo.Ringtoets/GUIs/DemoProjectGuiPlugin.cs =================================================================== diff -u -r0c64d8a6c718c0aa67403a16c94dd0c10f862455 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Demo/Ringtoets/src/Demo.Ringtoets/GUIs/DemoProjectGuiPlugin.cs (.../DemoProjectGuiPlugin.cs) (revision 0c64d8a6c718c0aa67403a16c94dd0c10f862455) +++ Demo/Ringtoets/src/Demo.Ringtoets/GUIs/DemoProjectGuiPlugin.cs (.../DemoProjectGuiPlugin.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,5 +1,4 @@ -using Core.Common.Gui; -using Core.Common.Gui.Forms; +using Core.Common.Gui.Forms; using Core.Common.Gui.Plugin; namespace Demo.Ringtoets.GUIs Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs =================================================================== diff -u -r0a94ed42cb943659d68be2ce6fb430f8f29fc3f3 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs (.../AddNewDemoAssessmentSectionCommandTest.cs) (revision 0a94ed42cb943659d68be2ce6fb430f8f29fc3f3) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs (.../AddNewDemoAssessmentSectionCommandTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; using Core.Common.Base; @@ -11,7 +10,6 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.Calculation; -using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Probabilistics; using Ringtoets.HydraRing.Data; using Ringtoets.Integration.Data; @@ -96,7 +94,7 @@ mocks.VerifyAll(); } - private void AssertCalculationInFailureMechanismSectionResult(PipingCalculationScenario calculation, FailureMechanismSectionResult[] sectionResults) + private void AssertCalculationInFailureMechanismSectionResult(PipingCalculationScenario calculation, PipingFailureMechanismSectionResult[] sectionResults) { Assert.AreEqual(283, sectionResults.Length); var sectionResultWithCalculation = sectionResults[22]; Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/GUIs/DemoProjectGuiPluginTest.cs =================================================================== diff -u -r0c64d8a6c718c0aa67403a16c94dd0c10f862455 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Demo/Ringtoets/test/Demo.Ringtoets.Test/GUIs/DemoProjectGuiPluginTest.cs (.../DemoProjectGuiPluginTest.cs) (revision 0c64d8a6c718c0aa67403a16c94dd0c10f862455) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/GUIs/DemoProjectGuiPluginTest.cs (.../DemoProjectGuiPluginTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,5 +1,4 @@ -using Core.Common.Gui; -using Core.Common.Gui.Forms; +using Core.Common.Gui.Forms; using Core.Common.Gui.Plugin; using Demo.Ringtoets.GUIs; Index: Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/FailureMechanismBase.cs =================================================================== diff -u -r266b001fc7fcb405383d2411a970efa735e3c66d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/FailureMechanismBase.cs (.../FailureMechanismBase.cs) (revision 266b001fc7fcb405383d2411a970efa735e3c66d) +++ Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/FailureMechanismBase.cs (.../FailureMechanismBase.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -37,6 +37,7 @@ { private readonly List sections; private double contribution; + private readonly IList sectionResults; /// /// Creates a new instance of the class. @@ -56,7 +57,7 @@ Name = failureMechanismName; Code = failureMechanismCode; sections = new List(); - SectionResults = new List(); + sectionResults = new List(); IsRelevant = true; } @@ -93,7 +94,13 @@ /// /// Gets the failure mechanism section results. /// - public IList SectionResults { get; private set; } + public IEnumerable SectionResults + { + get + { + return sectionResults; + } + } public long StorageId { get; set; } @@ -117,15 +124,15 @@ InsertSectionWhileMaintainingConnectivityOrder(section); } - SectionResults.Add(CreateFailureMechanismSectionResult(section)); + sectionResults.Add(CreateFailureMechanismSectionResult(section)); } protected abstract T CreateFailureMechanismSectionResult(FailureMechanismSection section); public void ClearAllSections() { sections.Clear(); - SectionResults.Clear(); + sectionResults.Clear(); } private static void ValidateParameters(string failureMechanismName, string failureMechanismCode) Index: Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/FailureMechanismSectionResult.cs =================================================================== diff -u -rb1c2f3f896147de67d46fde3bce9098d94054037 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/FailureMechanismSectionResult.cs (.../FailureMechanismSectionResult.cs) (revision b1c2f3f896147de67d46fde3bce9098d94054037) +++ Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/FailureMechanismSectionResult.cs (.../FailureMechanismSectionResult.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,30 +1,5 @@ -// Copyright (C) Stichting Deltares 2016. 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.Collections.Generic; -using System.Linq; +using System; using Core.Common.Base; -using Core.Common.Base.Data; -using Ringtoets.Common.Data.Calculation; namespace Ringtoets.Common.Data.FailureMechanism { @@ -33,8 +8,6 @@ /// public class FailureMechanismSectionResult : Observable { - private readonly FailureMechanismSection section; - /// /// Creates a new instance of . /// @@ -46,108 +19,12 @@ { throw new ArgumentNullException("section"); } - this.section = section; - CalculationScenarios = new List(); + Section = section; } /// /// Gets the encapsulated . /// - public FailureMechanismSection Section - { - get - { - return section; - } - } - - /// - /// Gets or sets the state of the assessment layer one. - /// - public bool AssessmentLayerOne { get; set; } - - /// - /// Gets the value of assessment layer two a. - /// - public RoundedDouble AssessmentLayerTwoA - { - get - { - return CalculationScenarios.Where(cs => cs.IsRelevant && cs.CalculationScenarioStatus == CalculationScenarioStatus.Done) - .Aggregate((RoundedDouble) 0.0, (current, scenario) => (current + scenario.Contribution * scenario.Probability)); - } - } - - /// - /// Gets or sets the value of assessment layer two b. - /// - public RoundedDouble AssessmentLayerTwoB { get; set; } - - /// - /// Gets or sets the value of assessment layer three. - /// - public RoundedDouble AssessmentLayerThree { get; set; } - - /// - /// Gets the contribution of all relevant together. - /// - public RoundedDouble TotalContribution - { - get - { - return (RoundedDouble) CalculationScenarios.Where(cs => cs.IsRelevant) - .Aggregate(0, (current, calculationScenario) => current + calculationScenario.Contribution); - } - } - - /// - /// Gets a list of . - /// - public List CalculationScenarios { get; private set; } - - /// - /// Gets the status of the section result depending on the calculation scenarios. - /// - public CalculationScenarioStatus CalculationScenarioStatus - { - get - { - return GetCalculationStatus(); - } - } - - private CalculationScenarioStatus GetCalculationStatus() - { - bool failed = false; - bool notCalculated = false; - foreach (var calculationScenario in CalculationScenarios.Where(cs => cs.IsRelevant)) - { - switch (calculationScenario.CalculationScenarioStatus) - { - case CalculationScenarioStatus.Failed: - failed = true; - break; - case CalculationScenarioStatus.NotCalculated: - notCalculated = true; - break; - case CalculationScenarioStatus.Done: - continue; - default: - throw new ArgumentOutOfRangeException(); - } - } - - if (failed) - { - return CalculationScenarioStatus.Failed; - } - - if (notCalculated) - { - return CalculationScenarioStatus.NotCalculated; - } - - return CalculationScenarioStatus.Done; - } + public FailureMechanismSection Section { get; private set; } } } \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/PipingFailureMechanismSectionResult.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/PipingFailureMechanismSectionResult.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/PipingFailureMechanismSectionResult.cs (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -0,0 +1,135 @@ +// Copyright (C) Stichting Deltares 2016. 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.Collections.Generic; +using System.Linq; +using Core.Common.Base.Data; +using Ringtoets.Common.Data.Calculation; + +namespace Ringtoets.Common.Data.FailureMechanism +{ + /// + /// This class holds the information of the result of the + /// for a piping assessment. + /// + public class PipingFailureMechanismSectionResult : FailureMechanismSectionResult + { + /// + /// Creates a new instance of . + /// + /// The to get the result from. + /// Thrown when is null. + public PipingFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + CalculationScenarios = new List(); + } + + /// + /// Gets or sets the state of the assessment layer one. + /// + public bool AssessmentLayerOne { get; set; } + + /// + /// Gets the value of assessment layer two a. + /// + public RoundedDouble AssessmentLayerTwoA + { + get + { + return CalculationScenarios.Where(cs => cs.IsRelevant && cs.CalculationScenarioStatus == CalculationScenarioStatus.Done) + .Aggregate((RoundedDouble) 0.0, (current, scenario) => (current + scenario.Contribution * scenario.Probability)); + } + } + + /// + /// Gets or sets the value of assessment layer two b. + /// + public RoundedDouble AssessmentLayerTwoB { get; set; } + + /// + /// Gets or sets the value of assessment layer three. + /// + public RoundedDouble AssessmentLayerThree { get; set; } + + /// + /// Gets the contribution of all relevant together. + /// + public RoundedDouble TotalContribution + { + get + { + return (RoundedDouble) CalculationScenarios.Where(cs => cs.IsRelevant) + .Aggregate(0, (current, calculationScenario) => current + calculationScenario.Contribution); + } + } + + /// + /// Gets a list of . + /// + public List CalculationScenarios { get; private set; } + + /// + /// Gets the status of the section result depending on the calculation scenarios. + /// + public CalculationScenarioStatus CalculationScenarioStatus + { + get + { + return GetCalculationStatus(); + } + } + + private CalculationScenarioStatus GetCalculationStatus() + { + bool failed = false; + bool notCalculated = false; + foreach (var calculationScenario in CalculationScenarios.Where(cs => cs.IsRelevant)) + { + switch (calculationScenario.CalculationScenarioStatus) + { + case CalculationScenarioStatus.Failed: + failed = true; + break; + case CalculationScenarioStatus.NotCalculated: + notCalculated = true; + break; + case CalculationScenarioStatus.Done: + continue; + default: + throw new ArgumentOutOfRangeException(); + } + } + + if (failed) + { + return CalculationScenarioStatus.Failed; + } + + if (notCalculated) + { + return CalculationScenarioStatus.NotCalculated; + } + + return CalculationScenarioStatus.Done; + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj =================================================================== diff -u -r0a94ed42cb943659d68be2ce6fb430f8f29fc3f3 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 0a94ed42cb943659d68be2ce6fb430f8f29fc3f3) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -49,10 +49,10 @@ + - Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionResultContext.cs =================================================================== diff -u -r266b001fc7fcb405383d2411a970efa735e3c66d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionResultContext.cs (.../FailureMechanismSectionResultContext.cs) (revision 266b001fc7fcb405383d2411a970efa735e3c66d) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionResultContext.cs (.../FailureMechanismSectionResultContext.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -33,7 +33,7 @@ /// /// Creates a new instance of . /// - /// The of to wrap. + /// The of to wrap. /// The belongs to. /// Thrown when or is null. public FailureMechanismSectionResultContext(IEnumerable sectionResults, IFailureMechanism failureMechanism) @@ -51,7 +51,7 @@ } /// - /// Gets the wrapped of . + /// Gets the wrapped of . /// public IEnumerable SectionResults { get; private set; } Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/ReferenceLineContext.cs =================================================================== diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/ReferenceLineContext.cs (.../ReferenceLineContext.cs) (revision a9aafffab97152303562110b1d789bacb465ce24) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/ReferenceLineContext.cs (.../ReferenceLineContext.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -21,7 +21,6 @@ using System; using Core.Common.Base; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Forms.Properties; Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.Designer.cs =================================================================== diff -u -rd49b0c7df08ca616edb5c3945adbb22eab479bf7 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.Designer.cs (.../FailureMechanismResultView.Designer.cs) (revision d49b0c7df08ca616edb5c3945adbb22eab479bf7) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.Designer.cs (.../FailureMechanismResultView.Designer.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -33,7 +33,7 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.dataGridView); - this.Name = "FailureMechanismResultView"; + this.Name = "PipingFailureMechanismResultView"; ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); this.ResumeLayout(false); Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs =================================================================== diff -u -r266b001fc7fcb405383d2411a970efa735e3c66d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs (.../FailureMechanismResultView.cs) (revision 266b001fc7fcb405383d2411a970efa735e3c66d) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs (.../FailureMechanismResultView.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -21,40 +21,30 @@ using System; using System.Collections.Generic; -using System.Drawing; -using System.Globalization; using System.Linq; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.Base.Data; using Core.Common.Controls.Views; -using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.Properties; using CoreCommonResources = Core.Common.Base.Properties.Resources; namespace Ringtoets.Common.Forms.Views { /// - /// The view for the . + /// The view for the . /// public partial class FailureMechanismResultView : UserControl, IView { private const double tolerance = 1e-6; private readonly Observer failureMechanismObserver; private readonly RecursiveObserver, FailureMechanismSectionResult> failureMechanismSectionResultObserver; - private readonly RecursiveObserver calculationInputObserver; - private readonly RecursiveObserver calculationOutputObserver; - private readonly RecursiveObserver calculationGroupObserver; private IEnumerable failureMechanismSectionResult; private FailureMechanismBase failureMechanism; - private DataGridViewTextBoxColumn assessmentLayerTwoA; - private DataGridViewTextBoxColumn assessmentLayerTwoB; - private DataGridViewTextBoxColumn assessmentLayerThree; /// - /// Creates a new instance of . + /// Creates a new instance of . /// public FailureMechanismResultView() { @@ -63,11 +53,6 @@ failureMechanismObserver = new Observer(UpdataDataGridViewDataSource); failureMechanismSectionResultObserver = new RecursiveObserver, FailureMechanismSectionResult>(RefreshDataGridView, mechanism => mechanism.SectionResults); - // The concat is needed to observe the input of calculations in child groups. - calculationInputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableInput()))); - calculationOutputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableOutput()))); - calculationGroupObserver = new RecursiveObserver(UpdataDataGridViewDataSource, c => c.Children); - Load += OnLoad; } /// @@ -85,13 +70,6 @@ failureMechanismObserver.Observable = failureMechanism; failureMechanismSectionResultObserver.Observable = failureMechanism; - - var calculatableFailureMechanism = failureMechanism as ICalculatableFailureMechanism; - CalculationGroup observableGroup = calculatableFailureMechanism != null ? calculatableFailureMechanism.CalculationsGroup : null; - - calculationInputObserver.Observable = observableGroup; - calculationOutputObserver.Observable = observableGroup; - calculationGroupObserver.Observable = observableGroup; } } @@ -122,9 +100,6 @@ failureMechanismObserver.Dispose(); failureMechanismSectionResultObserver.Dispose(); - calculationInputObserver.Dispose(); - calculationOutputObserver.Dispose(); - calculationGroupObserver.Dispose(); if (disposing && (components != null)) { @@ -133,20 +108,11 @@ base.Dispose(disposing); } - private void OnLoad(object sender, EventArgs e) - { - if (failureMechanismSectionResult != null && failureMechanismSectionResult.Any()) - { - SetRowStyling(); - } - } - private void InitializeDataGridView() { dataGridView.CurrentCellDirtyStateChanged += DataGridViewCurrentCellDirtyStateChanged; dataGridView.CellValidating += DataGridViewCellValidating; dataGridView.DataError += DataGridViewDataError; - dataGridView.CellFormatting += DataGridViewCellFormatting; dataGridView.GotFocus += DataGridViewGotFocus; var sectionName = new DataGridViewTextBoxColumn @@ -156,37 +122,8 @@ Name = "column_Name" }; - var assessmentLayerOne = new DataGridViewCheckBoxColumn - { - DataPropertyName = "AssessmentLayerOne", - HeaderText = Resources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_one, - Name = "column_AssessmentLayerOne" - }; - - assessmentLayerTwoA = new DataGridViewTextBoxColumn - { - DataPropertyName = "AssessmentLayerTwoA", - HeaderText = Resources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_two_a, - Name = "column_AssessmentLayerTwoA", - ReadOnly = true - }; - - assessmentLayerTwoB = new DataGridViewTextBoxColumn - { - DataPropertyName = "AssessmentLayerTwoB", - HeaderText = Resources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_two_b, - Name = "column_AssessmentLayerTwoB" - }; - - assessmentLayerThree = new DataGridViewTextBoxColumn - { - DataPropertyName = "AssessmentLayerThree", - HeaderText = Resources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_three, - Name = "column_AssessmentLayerThree" - }; - dataGridView.AutoGenerateColumns = false; - dataGridView.Columns.AddRange(sectionName, assessmentLayerOne, assessmentLayerTwoA, assessmentLayerTwoB, assessmentLayerThree); + dataGridView.Columns.AddRange(sectionName); foreach (var column in dataGridView.Columns.OfType()) { @@ -198,57 +135,14 @@ private void UpdataDataGridViewDataSource() { dataGridView.DataSource = failureMechanismSectionResult.Select(sr => new FailureMechanismSectionResultRow(sr)).ToList(); - SetRowStyling(); } private void RefreshDataGridView() { dataGridView.Refresh(); dataGridView.AutoResizeColumns(); - - SetRowStyling(); } - private void SetRowStyling() - { - foreach (DataGridViewRow row in dataGridView.Rows) - { - var checkboxSelected = (bool) row.Cells[1].Value; - - SetRowEditMode(row, checkboxSelected); - - SetRowStyle(checkboxSelected, row); - } - } - - private void SetRowEditMode(DataGridViewRow row, bool checkboxSelected) - { - row.Cells[assessmentLayerTwoB.Index].ReadOnly = checkboxSelected; - row.Cells[assessmentLayerThree.Index].ReadOnly = checkboxSelected; - } - - private void SetRowStyle(bool checkboxSelected, DataGridViewRow row) - { - if (checkboxSelected) - { - SetCellStyle(row.Cells[assessmentLayerTwoA.Index], Color.FromKnownColor(KnownColor.DarkGray), Color.FromKnownColor(KnownColor.GrayText)); - SetCellStyle(row.Cells[assessmentLayerTwoB.Index], Color.FromKnownColor(KnownColor.DarkGray), Color.FromKnownColor(KnownColor.GrayText)); - SetCellStyle(row.Cells[assessmentLayerThree.Index], Color.FromKnownColor(KnownColor.DarkGray), Color.FromKnownColor(KnownColor.GrayText)); - } - else - { - SetCellStyle(row.Cells[assessmentLayerTwoA.Index], Color.FromKnownColor(KnownColor.White), Color.FromKnownColor(KnownColor.ControlText)); - SetCellStyle(row.Cells[assessmentLayerTwoB.Index], Color.FromKnownColor(KnownColor.White), Color.FromKnownColor(KnownColor.ControlText)); - SetCellStyle(row.Cells[assessmentLayerThree.Index], Color.FromKnownColor(KnownColor.White), Color.FromKnownColor(KnownColor.ControlText)); - } - } - - private void SetCellStyle(DataGridViewCell cell, Color backgroundColor, Color textColor) - { - cell.Style.BackColor = backgroundColor; - cell.Style.ForeColor = textColor; - } - private void DataGridViewGotFocus(object sender, EventArgs eventArgs) { if (dataGridView.CurrentCell != null) @@ -274,67 +168,6 @@ } } - public bool AssessmentLayerOne - { - get - { - return FailureMechanismSectionResult.AssessmentLayerOne; - } - set - { - FailureMechanismSectionResult.AssessmentLayerOne = value; - FailureMechanismSectionResult.NotifyObservers(); - } - } - - public string AssessmentLayerTwoA - { - get - { - var relevantScenarios = FailureMechanismSectionResult.CalculationScenarios.Where(cs => cs.IsRelevant).ToArray(); - bool relevantScenarioAvailable = relevantScenarios.Length != 0; - - if (relevantScenarioAvailable && Math.Abs(FailureMechanismSectionResult.TotalContribution - 1.0) > tolerance) - { - return double.NaN.ToString(CultureInfo.CurrentCulture); - } - - if (!relevantScenarioAvailable - || FailureMechanismSectionResult.CalculationScenarioStatus != CalculationScenarioStatus.Done) - { - return Resources.FailureMechanismSectionResultRow_AssessmentLayerTwoA_No_result_dash; - } - - var layerTwoA = FailureMechanismSectionResult.AssessmentLayerTwoA; - - return string.Format(CoreCommonResources.ProbabilityPerYearFormat, layerTwoA.Value); - } - } - - public RoundedDouble AssessmentLayerTwoB - { - get - { - return FailureMechanismSectionResult.AssessmentLayerTwoB; - } - set - { - FailureMechanismSectionResult.AssessmentLayerTwoB = value; - } - } - - public RoundedDouble AssessmentLayerThree - { - get - { - return FailureMechanismSectionResult.AssessmentLayerThree; - } - set - { - FailureMechanismSectionResult.AssessmentLayerThree = value; - } - } - public FailureMechanismSectionResult FailureMechanismSectionResult { get; private set; } } @@ -374,50 +207,6 @@ } } - private void DataGridViewCellFormatting(object sender, DataGridViewCellFormattingEventArgs e) - { - var currentDataGridViewRow = dataGridView.Rows[e.RowIndex]; - var currentDataGridViewCell = currentDataGridViewRow.Cells[e.ColumnIndex]; - - FailureMechanismSectionResultRow resultRow = (FailureMechanismSectionResultRow) currentDataGridViewRow.DataBoundItem; - - if (resultRow != null && e.ColumnIndex == assessmentLayerTwoA.Index) - { - FailureMechanismSectionResult rowObject = resultRow.FailureMechanismSectionResult; - - var relevantScenarios = rowObject.CalculationScenarios.Where(cs => cs.IsRelevant).ToArray(); - bool relevantScenarioAvailable = relevantScenarios.Length != 0; - - if (rowObject.AssessmentLayerOne || !relevantScenarioAvailable) - { - currentDataGridViewCell.ErrorText = string.Empty; - return; - } - - if (Math.Abs(rowObject.TotalContribution - 1.0) > tolerance) - { - currentDataGridViewCell.ErrorText = Resources.FailureMechanismResultView_DataGridViewCellFormatting_Scenario_contribution_for_this_section_not_100; - return; - } - - var calculationScenarioStatus = rowObject.CalculationScenarioStatus; - - if (calculationScenarioStatus == CalculationScenarioStatus.NotCalculated) - { - currentDataGridViewCell.ErrorText = Resources.FailureMechanismResultView_DataGridViewCellFormatting_Not_all_calculations_are_executed; - return; - } - - if (calculationScenarioStatus == CalculationScenarioStatus.Failed) - { - currentDataGridViewCell.ErrorText = Resources.FailureMechanismResultView_DataGridViewCellFormatting_Not_all_calculations_have_valid_output; - return; - } - - currentDataGridViewCell.ErrorText = string.Empty; - } - } - #endregion } } \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/PipingFailureMechanismResultView.Designer.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/PipingFailureMechanismResultView.Designer.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/PipingFailureMechanismResultView.Designer.cs (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -0,0 +1,46 @@ +namespace Ringtoets.Common.Forms.Views +{ + partial class PipingFailureMechanismResultView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.dataGridView = new System.Windows.Forms.DataGridView(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.SuspendLayout(); + // + // dataGridView + // + this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView.Location = new System.Drawing.Point(0, 0); + this.dataGridView.Name = "dataGridView"; + this.dataGridView.Size = new System.Drawing.Size(150, 150); + this.dataGridView.TabIndex = 0; + // + // FailureMechanismResultView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.dataGridView); + this.Name = "PipingFailureMechanismResultView"; + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataGridView dataGridView; + } +} Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/PipingFailureMechanismResultView.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/PipingFailureMechanismResultView.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/PipingFailureMechanismResultView.cs (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -0,0 +1,423 @@ +// Copyright (C) Stichting Deltares 2016. 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.Collections.Generic; +using System.Drawing; +using System.Globalization; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.Controls.Views; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.Properties; +using CoreCommonResources = Core.Common.Base.Properties.Resources; + +namespace Ringtoets.Common.Forms.Views +{ + /// + /// The view for the . + /// + public partial class PipingFailureMechanismResultView : UserControl, IView + { + private const double tolerance = 1e-6; + private readonly Observer failureMechanismObserver; + private readonly RecursiveObserver, PipingFailureMechanismSectionResult> failureMechanismSectionResultObserver; + private readonly RecursiveObserver calculationInputObserver; + private readonly RecursiveObserver calculationOutputObserver; + private readonly RecursiveObserver calculationGroupObserver; + + private IEnumerable failureMechanismSectionResult; + private FailureMechanismBase failureMechanism; + private DataGridViewTextBoxColumn assessmentLayerTwoA; + private DataGridViewTextBoxColumn assessmentLayerTwoB; + private DataGridViewTextBoxColumn assessmentLayerThree; + + /// + /// Creates a new instance of . + /// + public PipingFailureMechanismResultView() + { + InitializeComponent(); + InitializeDataGridView(); + + failureMechanismObserver = new Observer(UpdataDataGridViewDataSource); + failureMechanismSectionResultObserver = new RecursiveObserver, PipingFailureMechanismSectionResult>(RefreshDataGridView, mechanism => mechanism.SectionResults); + // The concat is needed to observe the input of calculations in child groups. + calculationInputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableInput()))); + calculationOutputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableOutput()))); + calculationGroupObserver = new RecursiveObserver(UpdataDataGridViewDataSource, c => c.Children); + Load += OnLoad; + } + + /// + /// Gets or sets the failure mechanism. + /// + public IFailureMechanism FailureMechanism + { + get + { + return failureMechanism; + } + set + { + failureMechanism = value as FailureMechanismBase; + + failureMechanismObserver.Observable = failureMechanism; + failureMechanismSectionResultObserver.Observable = failureMechanism; + + var calculatableFailureMechanism = failureMechanism as ICalculatableFailureMechanism; + CalculationGroup observableGroup = calculatableFailureMechanism != null ? calculatableFailureMechanism.CalculationsGroup : null; + + calculationInputObserver.Observable = observableGroup; + calculationOutputObserver.Observable = observableGroup; + calculationGroupObserver.Observable = observableGroup; + } + } + + public object Data + { + get + { + return failureMechanismSectionResult; + } + set + { + failureMechanismSectionResult = value as IEnumerable; + + if (failureMechanismSectionResult != null) + { + UpdataDataGridViewDataSource(); + } + else + { + dataGridView.DataSource = null; + } + } + } + + protected override void Dispose(bool disposing) + { + FailureMechanism = null; + + failureMechanismObserver.Dispose(); + failureMechanismSectionResultObserver.Dispose(); + calculationInputObserver.Dispose(); + calculationOutputObserver.Dispose(); + calculationGroupObserver.Dispose(); + + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + private void OnLoad(object sender, EventArgs e) + { + if (failureMechanismSectionResult != null && failureMechanismSectionResult.Any()) + { + SetRowStyling(); + } + } + + private void InitializeDataGridView() + { + dataGridView.CurrentCellDirtyStateChanged += DataGridViewCurrentCellDirtyStateChanged; + dataGridView.CellValidating += DataGridViewCellValidating; + dataGridView.DataError += DataGridViewDataError; + dataGridView.CellFormatting += DataGridViewCellFormatting; + dataGridView.GotFocus += DataGridViewGotFocus; + + var sectionName = new DataGridViewTextBoxColumn + { + DataPropertyName = "Name", + HeaderText = Resources.FailureMechanismResultView_InitializeDataGridView_Section_name, + Name = "column_Name" + }; + + var assessmentLayerOne = new DataGridViewCheckBoxColumn + { + DataPropertyName = "AssessmentLayerOne", + HeaderText = Resources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_one, + Name = "column_AssessmentLayerOne" + }; + + assessmentLayerTwoA = new DataGridViewTextBoxColumn + { + DataPropertyName = "AssessmentLayerTwoA", + HeaderText = Resources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_two_a, + Name = "column_AssessmentLayerTwoA", + ReadOnly = true + }; + + assessmentLayerTwoB = new DataGridViewTextBoxColumn + { + DataPropertyName = "AssessmentLayerTwoB", + HeaderText = Resources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_two_b, + Name = "column_AssessmentLayerTwoB" + }; + + assessmentLayerThree = new DataGridViewTextBoxColumn + { + DataPropertyName = "AssessmentLayerThree", + HeaderText = Resources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_three, + Name = "column_AssessmentLayerThree" + }; + + dataGridView.AutoGenerateColumns = false; + dataGridView.Columns.AddRange(sectionName, assessmentLayerOne, assessmentLayerTwoA, assessmentLayerTwoB, assessmentLayerThree); + + foreach (var column in dataGridView.Columns.OfType()) + { + column.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; + column.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; + } + } + + private void UpdataDataGridViewDataSource() + { + dataGridView.DataSource = failureMechanismSectionResult.Select(sr => new FailureMechanismSectionResultRow(sr)).ToList(); + SetRowStyling(); + } + + private void RefreshDataGridView() + { + dataGridView.Refresh(); + dataGridView.AutoResizeColumns(); + + SetRowStyling(); + } + + private void SetRowStyling() + { + foreach (DataGridViewRow row in dataGridView.Rows) + { + var checkboxSelected = (bool) row.Cells[1].Value; + + SetRowEditMode(row, checkboxSelected); + + SetRowStyle(checkboxSelected, row); + } + } + + private void SetRowEditMode(DataGridViewRow row, bool checkboxSelected) + { + row.Cells[assessmentLayerTwoB.Index].ReadOnly = checkboxSelected; + row.Cells[assessmentLayerThree.Index].ReadOnly = checkboxSelected; + } + + private void SetRowStyle(bool checkboxSelected, DataGridViewRow row) + { + if (checkboxSelected) + { + SetCellStyle(row.Cells[assessmentLayerTwoA.Index], Color.FromKnownColor(KnownColor.DarkGray), Color.FromKnownColor(KnownColor.GrayText)); + SetCellStyle(row.Cells[assessmentLayerTwoB.Index], Color.FromKnownColor(KnownColor.DarkGray), Color.FromKnownColor(KnownColor.GrayText)); + SetCellStyle(row.Cells[assessmentLayerThree.Index], Color.FromKnownColor(KnownColor.DarkGray), Color.FromKnownColor(KnownColor.GrayText)); + } + else + { + SetCellStyle(row.Cells[assessmentLayerTwoA.Index], Color.FromKnownColor(KnownColor.White), Color.FromKnownColor(KnownColor.ControlText)); + SetCellStyle(row.Cells[assessmentLayerTwoB.Index], Color.FromKnownColor(KnownColor.White), Color.FromKnownColor(KnownColor.ControlText)); + SetCellStyle(row.Cells[assessmentLayerThree.Index], Color.FromKnownColor(KnownColor.White), Color.FromKnownColor(KnownColor.ControlText)); + } + } + + private void SetCellStyle(DataGridViewCell cell, Color backgroundColor, Color textColor) + { + cell.Style.BackColor = backgroundColor; + cell.Style.ForeColor = textColor; + } + + private void DataGridViewGotFocus(object sender, EventArgs eventArgs) + { + if (dataGridView.CurrentCell != null) + { + dataGridView.BeginEdit(true); // Always start editing after setting the focus (otherwise data grid view cell dirty events are no longer fired when using the keyboard...) + } + } + + #region Nested types + + private class FailureMechanismSectionResultRow + { + public FailureMechanismSectionResultRow(PipingFailureMechanismSectionResult pipingFailureMechanismSectionResult) + { + PipingFailureMechanismSectionResult = pipingFailureMechanismSectionResult; + } + + public string Name + { + get + { + return PipingFailureMechanismSectionResult.Section.Name; + } + } + + public bool AssessmentLayerOne + { + get + { + return PipingFailureMechanismSectionResult.AssessmentLayerOne; + } + set + { + PipingFailureMechanismSectionResult.AssessmentLayerOne = value; + PipingFailureMechanismSectionResult.NotifyObservers(); + } + } + + public string AssessmentLayerTwoA + { + get + { + var relevantScenarios = PipingFailureMechanismSectionResult.CalculationScenarios.Where(cs => cs.IsRelevant).ToArray(); + bool relevantScenarioAvailable = relevantScenarios.Length != 0; + + if (relevantScenarioAvailable && Math.Abs(PipingFailureMechanismSectionResult.TotalContribution - 1.0) > tolerance) + { + return double.NaN.ToString(CultureInfo.CurrentCulture); + } + + if (!relevantScenarioAvailable + || PipingFailureMechanismSectionResult.CalculationScenarioStatus != CalculationScenarioStatus.Done) + { + return Resources.FailureMechanismSectionResultRow_AssessmentLayerTwoA_No_result_dash; + } + + var layerTwoA = PipingFailureMechanismSectionResult.AssessmentLayerTwoA; + + return string.Format(CoreCommonResources.ProbabilityPerYearFormat, layerTwoA.Value); + } + } + + public RoundedDouble AssessmentLayerTwoB + { + get + { + return PipingFailureMechanismSectionResult.AssessmentLayerTwoB; + } + set + { + PipingFailureMechanismSectionResult.AssessmentLayerTwoB = value; + } + } + + public RoundedDouble AssessmentLayerThree + { + get + { + return PipingFailureMechanismSectionResult.AssessmentLayerThree; + } + set + { + PipingFailureMechanismSectionResult.AssessmentLayerThree = value; + } + } + + public PipingFailureMechanismSectionResult PipingFailureMechanismSectionResult { get; private set; } + } + + #endregion + + #region Event handling + + private void DataGridViewCurrentCellDirtyStateChanged(object sender, EventArgs e) + { + // Ensure checkbox values are directly committed + DataGridViewColumn currentColumn = dataGridView.Columns[dataGridView.CurrentCell.ColumnIndex]; + if (currentColumn is DataGridViewCheckBoxColumn) + { + dataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit); + } + } + + private void DataGridViewCellValidating(object sender, DataGridViewCellValidatingEventArgs e) + { + dataGridView.Rows[e.RowIndex].ErrorText = String.Empty; + + var cellEditValue = e.FormattedValue.ToString(); + if (string.IsNullOrWhiteSpace(cellEditValue)) + { + dataGridView.Rows[e.RowIndex].ErrorText = Resources.DataGridViewCellValidating_Text_may_not_be_empty; + } + } + + private void DataGridViewDataError(object sender, DataGridViewDataErrorEventArgs e) + { + e.ThrowException = false; + e.Cancel = true; + + if (string.IsNullOrWhiteSpace(dataGridView.Rows[e.RowIndex].ErrorText) && e.Exception != null) + { + dataGridView.Rows[e.RowIndex].ErrorText = e.Exception.Message; + } + } + + private void DataGridViewCellFormatting(object sender, DataGridViewCellFormattingEventArgs e) + { + var currentDataGridViewRow = dataGridView.Rows[e.RowIndex]; + var currentDataGridViewCell = currentDataGridViewRow.Cells[e.ColumnIndex]; + + FailureMechanismSectionResultRow resultRow = (FailureMechanismSectionResultRow) currentDataGridViewRow.DataBoundItem; + + if (resultRow != null && e.ColumnIndex == assessmentLayerTwoA.Index) + { + PipingFailureMechanismSectionResult rowObject = resultRow.PipingFailureMechanismSectionResult; + + var relevantScenarios = rowObject.CalculationScenarios.Where(cs => cs.IsRelevant).ToArray(); + bool relevantScenarioAvailable = relevantScenarios.Length != 0; + + if (rowObject.AssessmentLayerOne || !relevantScenarioAvailable) + { + currentDataGridViewCell.ErrorText = string.Empty; + return; + } + + if (Math.Abs(rowObject.TotalContribution - 1.0) > tolerance) + { + currentDataGridViewCell.ErrorText = Resources.FailureMechanismResultView_DataGridViewCellFormatting_Scenario_contribution_for_this_section_not_100; + return; + } + + var calculationScenarioStatus = rowObject.CalculationScenarioStatus; + + if (calculationScenarioStatus == CalculationScenarioStatus.NotCalculated) + { + currentDataGridViewCell.ErrorText = Resources.FailureMechanismResultView_DataGridViewCellFormatting_Not_all_calculations_are_executed; + return; + } + + if (calculationScenarioStatus == CalculationScenarioStatus.Failed) + { + currentDataGridViewCell.ErrorText = Resources.FailureMechanismResultView_DataGridViewCellFormatting_Not_all_calculations_have_valid_output; + return; + } + + currentDataGridViewCell.ErrorText = string.Empty; + } + } + + #endregion + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/PipingFailureMechanismResultView.resx =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/PipingFailureMechanismResultView.resx (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/PipingFailureMechanismResultView.resx (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.IO/FailureMechanismSectionReader.cs =================================================================== diff -u -r04b631b486b742c5339deb1d5504bb13ab5e248d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/src/Ringtoets.Common.IO/FailureMechanismSectionReader.cs (.../FailureMechanismSectionReader.cs) (revision 04b631b486b742c5339deb1d5504bb13ab5e248d) +++ Ringtoets/Common/src/Ringtoets.Common.IO/FailureMechanismSectionReader.cs (.../FailureMechanismSectionReader.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -30,7 +30,6 @@ using Core.Components.Gis.Data; using Core.Components.Gis.Features; using Core.Components.Gis.IO.Readers; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.FailureMechanism; using CoreCommonUtilsResources = Core.Common.Utils.Properties.Resources; using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; Index: Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLineReader.cs =================================================================== diff -u -r7a239dafc3209ea3c12b7c25d94ea6aec2918628 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLineReader.cs (.../ReferenceLineReader.cs) (revision 7a239dafc3209ea3c12b7c25d94ea6aec2918628) +++ Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLineReader.cs (.../ReferenceLineReader.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -29,9 +29,7 @@ using Core.Common.Utils.Builders; using Core.Components.Gis.Data; using Core.Components.Gis.Geometries; -using Core.Components.Gis.IO; using Core.Components.Gis.IO.Readers; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using CoreCommonUtilsResources = Core.Common.Utils.Properties.Resources; using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; Fisheye: Tag 64d5609bb2912cd52dc74deffdd189222e240599 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/FailureMechanismSectionResultTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj =================================================================== diff -u -rd148009f276fb1d4a7a4cbacb730c31114b7e4ae -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision d148009f276fb1d4a7a4cbacb730c31114b7e4ae) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -63,7 +63,6 @@ - Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionResultContextTest.cs =================================================================== diff -u -r266b001fc7fcb405383d2411a970efa735e3c66d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionResultContextTest.cs (.../FailureMechanismSectionResultContextTest.cs) (revision 266b001fc7fcb405383d2411a970efa735e3c66d) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionResultContextTest.cs (.../FailureMechanismSectionResultContextTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using Core.Common.Base.Geometry; using NUnit.Framework; using Rhino.Mocks; Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionsContextTest.cs =================================================================== diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionsContextTest.cs (.../FailureMechanismSectionsContextTest.cs) (revision a9aafffab97152303562110b1d789bacb465ce24) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionsContextTest.cs (.../FailureMechanismSectionsContextTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -7,8 +7,6 @@ using NUnit.Framework; using Rhino.Mocks; - -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.PresentationObjects; Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/ReferenceLineContextTest.cs =================================================================== diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/ReferenceLineContextTest.cs (.../ReferenceLineContextTest.cs) (revision a9aafffab97152303562110b1d789bacb465ce24) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/ReferenceLineContextTest.cs (.../ReferenceLineContextTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -3,7 +3,6 @@ using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Forms.PresentationObjects; Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r0bb125b90287c712f303d231c1083fc79ef45a9a -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 0bb125b90287c712f303d231c1083fc79ef45a9a) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -70,7 +70,6 @@ - Fisheye: Tag 64d5609bb2912cd52dc74deffdd189222e240599 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/FailureMechanismSectionReaderTest.cs =================================================================== diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/FailureMechanismSectionReaderTest.cs (.../FailureMechanismSectionReaderTest.cs) (revision a9aafffab97152303562110b1d789bacb465ce24) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/FailureMechanismSectionReaderTest.cs (.../FailureMechanismSectionReaderTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -5,7 +5,6 @@ using Core.Common.IO.Exceptions; using Core.Common.TestUtil; using NUnit.Framework; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.FailureMechanism; namespace Ringtoets.Common.IO.Test Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLineReaderTest.cs =================================================================== diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLineReaderTest.cs (.../ReferenceLineReaderTest.cs) (revision a9aafffab97152303562110b1d789bacb465ce24) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLineReaderTest.cs (.../ReferenceLineReaderTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -5,7 +5,6 @@ using Core.Common.IO.Exceptions; using Core.Common.TestUtil; using NUnit.Framework; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; namespace Ringtoets.Common.IO.Test Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/MapDataFactory.cs =================================================================== diff -u -r04b631b486b742c5339deb1d5504bb13ab5e248d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/MapDataFactory.cs (.../MapDataFactory.cs) (revision 04b631b486b742c5339deb1d5504bb13ab5e248d) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/MapDataFactory.cs (.../MapDataFactory.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -29,7 +29,6 @@ using Core.Components.Gis.Features; using Core.Components.Gis.Geometries; using Core.Components.Gis.Style; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.HydraRing.Data; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsApplicationPlugin.cs =================================================================== diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsApplicationPlugin.cs (.../RingtoetsApplicationPlugin.cs) (revision a9aafffab97152303562110b1d789bacb465ce24) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsApplicationPlugin.cs (.../RingtoetsApplicationPlugin.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -24,8 +24,6 @@ using Core.Common.Base.Data; using Core.Common.Base.IO; using Core.Common.Base.Plugin; - -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.IO; Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs =================================================================== diff -u -rd1c60b79a5add63479f44fdbdbbd16d3593949dd -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision d1c60b79a5add63479f44fdbdbbd16d3593949dd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -308,7 +308,10 @@ var failureMechanismContext = o as IFailureMechanismContext; if (assessmentSection != null) { - return assessmentSection.GetFailureMechanisms().Any(fm => ReferenceEquals(view.Data, ((FailureMechanismBase) fm).SectionResults)); + return assessmentSection + .GetFailureMechanisms() + .OfType>() + .Any(fm => ReferenceEquals(view.Data,fm.SectionResults)); } if (failureMechanismContext != null) { Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsRibbon.xaml.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsRibbon.xaml.cs (.../RingtoetsRibbon.xaml.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsRibbon.xaml.cs (.../RingtoetsRibbon.xaml.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -20,8 +20,6 @@ // All rights reserved. using System.Collections.Generic; - -using Core.Common.Controls; using Core.Common.Controls.Commands; using Core.Common.Gui.Forms; using Fluent; Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Placeholders/StandAloneFailureMechanismTest.cs =================================================================== diff -u -r60f9f8cfadfe1b22e5989aa92ab9839c4623338d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Placeholders/StandAloneFailureMechanismTest.cs (.../StandAloneFailureMechanismTest.cs) (revision 60f9f8cfadfe1b22e5989aa92ab9839c4623338d) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Placeholders/StandAloneFailureMechanismTest.cs (.../StandAloneFailureMechanismTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -23,6 +23,7 @@ using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Piping.Data; namespace Ringtoets.Integration.Data.Test.Placeholders { Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs =================================================================== diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs (.../HydraulicBoundaryDatabaseContextTest.cs) (revision a9aafffab97152303562110b1d789bacb465ce24) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs (.../HydraulicBoundaryDatabaseContextTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -23,7 +23,6 @@ using Core.Common.Base; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Integration.Forms.PresentationObjects; Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/AssessmentSectionPropertiesTest.cs =================================================================== diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/AssessmentSectionPropertiesTest.cs (.../AssessmentSectionPropertiesTest.cs) (revision a9aafffab97152303562110b1d789bacb465ce24) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/AssessmentSectionPropertiesTest.cs (.../AssessmentSectionPropertiesTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -2,8 +2,6 @@ using Core.Common.Gui.PropertyBag; using NUnit.Framework; using Rhino.Mocks; - -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Integration.Data; using Ringtoets.Integration.Forms.PropertyClasses; Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDatabasePropertiesTest.cs =================================================================== diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDatabasePropertiesTest.cs (.../HydraulicBoundaryDatabasePropertiesTest.cs) (revision a9aafffab97152303562110b1d789bacb465ce24) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryDatabasePropertiesTest.cs (.../HydraulicBoundaryDatabasePropertiesTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -23,7 +23,6 @@ using Core.Common.Gui.PropertyBag; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.HydraRing.Data; using Ringtoets.Integration.Forms.PresentationObjects; Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r266b001fc7fcb405383d2411a970efa735e3c66d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../FailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 266b001fc7fcb405383d2411a970efa735e3c66d) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../FailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -19,17 +19,18 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Collections.Generic; using System.Linq; using Core.Common.Controls.TreeView; using Core.Common.Gui; using Core.Common.Gui.ContextMenu; using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; +using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Integration.Plugin; -using Ringtoets.Piping.Data; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.Integration.Forms.Test.TreeNodeInfos @@ -75,7 +76,7 @@ // Setup mocks.ReplayAll(); - var mechanism = new PipingFailureMechanism(); + var mechanism = new SimpleFailureMechanism(); var context = new FailureMechanismSectionResultContext(mechanism.SectionResults, mechanism); // Call @@ -121,4 +122,21 @@ mocks.VerifyAll(); } } + + public class SimpleFailureMechanism : FailureMechanismBase { + public SimpleFailureMechanism() : base("N", "C") {} + + public override IEnumerable Calculations + { + get + { + throw new System.NotImplementedException(); + } + } + + protected override FailureMechanismSectionResult CreateFailureMechanismSectionResult(FailureMechanismSection section) + { + throw new System.NotImplementedException(); + } + } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/ReferenceLineContextTreeNodeInfoTest.cs =================================================================== diff -u -rfc38d18fc6ff1749476da0ea43281d5d80568283 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/ReferenceLineContextTreeNodeInfoTest.cs (.../ReferenceLineContextTreeNodeInfoTest.cs) (revision fc38d18fc6ff1749476da0ea43281d5d80568283) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/ReferenceLineContextTreeNodeInfoTest.cs (.../ReferenceLineContextTreeNodeInfoTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -9,8 +9,6 @@ using NUnit.Framework; using Rhino.Mocks; - -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Integration.Plugin; Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsApplicationPluginTest.cs =================================================================== diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsApplicationPluginTest.cs (.../RingtoetsApplicationPluginTest.cs) (revision a9aafffab97152303562110b1d789bacb465ce24) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsApplicationPluginTest.cs (.../RingtoetsApplicationPluginTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -4,8 +4,6 @@ using Core.Common.Base.Plugin; using Core.Common.TestUtil; using NUnit.Framework; - -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.IO; using Ringtoets.Integration.Data; Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/AssessmentSectionViewInfoTest.cs =================================================================== diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/AssessmentSectionViewInfoTest.cs (.../AssessmentSectionViewInfoTest.cs) (revision a9aafffab97152303562110b1d789bacb465ce24) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/AssessmentSectionViewInfoTest.cs (.../AssessmentSectionViewInfoTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -3,7 +3,6 @@ using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Integration.Forms.Views; using RingtoetsFormsResources = Ringtoets.Integration.Forms.Properties.Resources; Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismResultViewInfoTest.cs =================================================================== diff -u -r266b001fc7fcb405383d2411a970efa735e3c66d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismResultViewInfoTest.cs (.../FailureMechanismResultViewInfoTest.cs) (revision 266b001fc7fcb405383d2411a970efa735e3c66d) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismResultViewInfoTest.cs (.../FailureMechanismResultViewInfoTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -31,6 +31,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.Views; +using Ringtoets.Piping.Data; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.Integration.Plugin.Test.ViewInfos @@ -188,8 +189,9 @@ var failureMechanism = new Simple(); viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); - assessmentSectionMock.Expect(asm => asm.GetFailureMechanisms()).Return(new[] + assessmentSectionMock.Expect(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[] { + new PipingFailureMechanism(), failureMechanism }); Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingCalculationGroupExtensions.cs =================================================================== diff -u -r0a94ed42cb943659d68be2ce6fb430f8f29fc3f3 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingCalculationGroupExtensions.cs (.../PipingCalculationGroupExtensions.cs) (revision 0a94ed42cb943659d68be2ce6fb430f8f29fc3f3) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingCalculationGroupExtensions.cs (.../PipingCalculationGroupExtensions.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -32,7 +32,7 @@ public static class PipingCalculationGroupExtensions { /// - /// Adds to . + /// Adds to . /// /// The group containing the calculations. /// The failure mechanism containing the section results. Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs =================================================================== diff -u -r266b001fc7fcb405383d2411a970efa735e3c66d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs (.../PipingFailureMechanism.cs) (revision 266b001fc7fcb405383d2411a970efa735e3c66d) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs (.../PipingFailureMechanism.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -32,7 +32,7 @@ /// /// Model for performing piping calculations. /// - public class PipingFailureMechanism : FailureMechanismBase, ICalculatableFailureMechanism + public class PipingFailureMechanism : FailureMechanismBase, ICalculatableFailureMechanism { /// /// Initializes a new instance of the class. @@ -55,9 +55,9 @@ } } - protected override FailureMechanismSectionResult CreateFailureMechanismSectionResult(FailureMechanismSection section) + protected override PipingFailureMechanismSectionResult CreateFailureMechanismSectionResult(FailureMechanismSection section) { - return new FailureMechanismSectionResult(section); + return new PipingFailureMechanismSectionResult(section); } public override double Contribution Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj =================================================================== diff -u -r60f9f8cfadfe1b22e5989aa92ab9839c4623338d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 60f9f8cfadfe1b22e5989aa92ab9839c4623338d) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -56,6 +56,7 @@ + Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj =================================================================== diff -u -r23a37b025a5d0358c1f30fb31de41a2c284519a5 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 23a37b025a5d0358c1f30fb31de41a2c284519a5) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -102,6 +102,12 @@ PipingCalculationsView.cs + + UserControl + + + PipingFailureMechanismResultView.cs + UserControl @@ -207,6 +213,10 @@ PipingCalculationsView.cs Designer + + PipingFailureMechanismResultView.cs + Designer + PipingFailureMechanismView.cs Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SurfaceLines/CharacteristicPointsCsvReader.cs =================================================================== diff -u -r9a4c74a9d2cc49987adf0049919baafa6e12a618 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SurfaceLines/CharacteristicPointsCsvReader.cs (.../CharacteristicPointsCsvReader.cs) (revision 9a4c74a9d2cc49987adf0049919baafa6e12a618) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SurfaceLines/CharacteristicPointsCsvReader.cs (.../CharacteristicPointsCsvReader.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -25,7 +25,6 @@ using System.IO; using System.Linq; using Core.Common.Base.Geometry; -using Core.Common.IO; using Core.Common.IO.Exceptions; using Core.Common.IO.Readers; using Core.Common.Utils; Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs =================================================================== diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision a9aafffab97152303562110b1d789bacb465ce24) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -31,8 +31,6 @@ using Core.Common.IO.Readers; using log4net; - -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Piping.Forms.PresentationObjects; using Ringtoets.Piping.IO.SurfaceLines; Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingFileImporterProvider.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingFileImporterProvider.cs (.../PipingFileImporterProvider.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingFileImporterProvider.cs (.../PipingFileImporterProvider.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -20,8 +20,6 @@ // All rights reserved. using System.Collections.Generic; - -using Core.Common.Base; using Core.Common.Base.IO; using Ringtoets.Piping.Plugin.FileImporter; Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs =================================================================== diff -u -rbd29bacc20bc58cc67f27dd33fa4fa6b41db873c -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision bd29bacc20bc58cc67f27dd33fa4fa6b41db873c) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -86,6 +86,15 @@ AdditionalDataCheck = context => context.WrappedData.IsRelevant }; + yield return new ViewInfo, IEnumerable, PipingFailureMechanismResultView> + { + GetViewName = (v, o) => RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName, + Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, + CloseForData = CloseFailureMechanismResultViewForData, + GetViewData = context => context.SectionResults, + AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism + }; + yield return new ViewInfo { GetViewData = context => context.WrappedData, @@ -121,6 +130,15 @@ PipingCalculationGroupContextContextMenuStrip, PipingCalculationGroupContextOnNodeRemoved); + yield return new TreeNodeInfo> + { + Text = context => RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName, + Image = context => RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .Build() + }; + yield return new TreeNodeInfo { Text = pipingInputContext => PipingFormsResources.PipingInputContext_NodeDisplayName, @@ -230,7 +248,7 @@ }; } - # region PipingCalculationsView ViewInfo + # region PipingFailureMechanismView ViewInfo private bool ClosePipingFailureMechanismViewForData(PipingFailureMechanismView view, object o) { @@ -247,6 +265,29 @@ # endregion + # region FailureMechanismResultsView ViewInfo + + private static bool CloseFailureMechanismResultViewForData(PipingFailureMechanismResultView view, object o) + { + var assessmentSection = o as IAssessmentSection; + var failureMechanism = o as IFailureMechanism; + var failureMechanismContext = o as IFailureMechanismContext; + if (assessmentSection != null) + { + return assessmentSection + .GetFailureMechanisms() + .OfType() + .Any(fm => ReferenceEquals(view.Data, fm.SectionResults)); + } + if (failureMechanismContext != null) + { + failureMechanism = failureMechanismContext.WrappedData; + } + return failureMechanism != null && ReferenceEquals(view.Data, ((FailureMechanismBase)failureMechanism).SectionResults); + } + + # endregion + # region PipingCalculationsView ViewInfo private static bool ClosePipingCalculationsViewForData(PipingCalculationsView view, object o) @@ -383,7 +424,7 @@ { return new ArrayList { - new FailureMechanismSectionResultContext(failureMechanism.SectionResults, failureMechanism) + new FailureMechanismSectionResultContext(failureMechanism.SectionResults, failureMechanism) }; } Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationScenarioService.cs =================================================================== diff -u -r073f4371610f4964a1f877737184494a684f7610 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationScenarioService.cs (.../PipingCalculationScenarioService.cs) (revision 073f4371610f4964a1f877737184494a684f7610) +++ Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationScenarioService.cs (.../PipingCalculationScenarioService.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -22,7 +22,6 @@ using System; using System.Linq; using Core.Common.Base.Geometry; -using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Piping.Data; using Ringtoets.Piping.Primitives; @@ -34,10 +33,10 @@ public static class PipingCalculationScenarioService { /// - /// Sets the to the corresponding for the . + /// Sets the to the corresponding for the . /// /// The calculation scenario to set containing the new surface line. - /// The failure mechanism containing the . + /// The failure mechanism containing the . /// The old surface line for the calculation scenario. /// Thrown when or is null. public static void SyncCalculationScenarioWithNewSurfaceLine(PipingCalculationScenario calculationScenario, PipingFailureMechanism failureMechanism, RingtoetsPipingSurfaceLine oldSurfaceLine) @@ -62,10 +61,10 @@ } /// - /// Removes the from the . + /// Removes the from the . /// /// The calculation scenario to remove. - /// The failure mechanism containing the . + /// The failure mechanism containing the . /// Thrown when or is null. public static void RemoveCalculationScenarioFromSectionResult(PipingCalculationScenario calculationScenario, PipingFailureMechanism failureMechanism) { Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismTest.cs =================================================================== diff -u -r266b001fc7fcb405383d2411a970efa735e3c66d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismTest.cs (.../PipingFailureMechanismTest.cs) (revision 266b001fc7fcb405383d2411a970efa735e3c66d) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismTest.cs (.../PipingFailureMechanismTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -48,7 +48,7 @@ var piping = new PipingFailureMechanism(); // Assert - Assert.IsInstanceOf>(piping); + Assert.IsInstanceOf>(piping); Assert.IsInstanceOf(piping); Assert.AreEqual(Resources.PipingFailureMechanism_DisplayName, piping.Name); Assert.AreEqual(Resources.PipingFailureMechanism_DisplayCode, piping.Code); Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs =================================================================== diff -u -r3ab528e2b002824d82df7b45c2901c4f96fa148c -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs (.../PipingSoilProfileTest.cs) (revision 3ab528e2b002824d82df7b45c2901c4f96fa148c) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs (.../PipingSoilProfileTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -25,7 +25,6 @@ using System.Linq; using Core.Common.TestUtil; using NUnit.Framework; -using Ringtoets.Piping.Data.Properties; using Ringtoets.Piping.Primitives; using PrimitivesResources = Ringtoets.Piping.Primitives.Properties.Resources; Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj =================================================================== diff -u -r60f9f8cfadfe1b22e5989aa92ab9839c4623338d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 60f9f8cfadfe1b22e5989aa92ab9839c4623338d) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -61,6 +61,7 @@ + Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingFailureMechanismContextPropertiesTest.cs =================================================================== diff -u -r77158a296743c3b3457336706fdbea047daf4886 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingFailureMechanismContextPropertiesTest.cs (.../PipingFailureMechanismContextPropertiesTest.cs) (revision 77158a296743c3b3457336706fdbea047daf4886) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingFailureMechanismContextPropertiesTest.cs (.../PipingFailureMechanismContextPropertiesTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -2,7 +2,6 @@ using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Piping.Data; using Ringtoets.Piping.Forms.PresentationObjects; Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/RingtoetsPipingSurfaceLinePropertiesTest.cs =================================================================== diff -u -r10779bb6a6db2d00f4627b2bc190e7e35e1fee3e -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/RingtoetsPipingSurfaceLinePropertiesTest.cs (.../RingtoetsPipingSurfaceLinePropertiesTest.cs) (revision 10779bb6a6db2d00f4627b2bc190e7e35e1fee3e) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/RingtoetsPipingSurfaceLinePropertiesTest.cs (.../RingtoetsPipingSurfaceLinePropertiesTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,13 +1,7 @@ -using System; -using System.Windows.Forms.VisualStyles; -using Core.Common.Base.Geometry; -using Core.Common.Gui; +using Core.Common.Base.Geometry; using Core.Common.Gui.PropertyBag; using NUnit.Framework; - -using Ringtoets.Piping.Data; - using Ringtoets.Piping.Forms.PropertyClasses; using Ringtoets.Piping.Primitives; Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj =================================================================== diff -u -r60f9f8cfadfe1b22e5989aa92ab9839c4623338d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 60f9f8cfadfe1b22e5989aa92ab9839c4623338d) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -101,6 +101,7 @@ + Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -r266b001fc7fcb405383d2411a970efa735e3c66d -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs (.../PipingFailureMechanismContextTreeNodeInfoTest.cs) (revision 266b001fc7fcb405383d2411a970efa735e3c66d) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs (.../PipingFailureMechanismContextTreeNodeInfoTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -36,7 +36,6 @@ using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Calculation; -using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Piping.Data; using Ringtoets.Piping.Data.TestUtil; @@ -172,7 +171,7 @@ Assert.AreEqual("Uitvoer", outputsFolder.Name); Assert.AreEqual(TreeFolderCategory.Output, outputsFolder.Category); - var failureMechanismResultsContext = (FailureMechanismSectionResultContext)outputsFolder.Contents[0]; + var failureMechanismResultsContext = (FailureMechanismSectionResultContext)outputsFolder.Contents[0]; Assert.AreSame(pipingFailureMechanism, failureMechanismResultsContext.FailureMechanism); Assert.AreSame(pipingFailureMechanism.SectionResults, failureMechanismResultsContext.SectionResults); mocks.VerifyAll(); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs =================================================================== diff -u -r10779bb6a6db2d00f4627b2bc190e7e35e1fee3e -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs (.../RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs) (revision 10779bb6a6db2d00f4627b2bc190e7e35e1fee3e) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs (.../RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -5,7 +5,6 @@ using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Piping.Data; using Ringtoets.Piping.Forms.Properties; using Ringtoets.Piping.Plugin; using Ringtoets.Piping.Primitives; Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/LognormalDistributionDesignVariableTypeConverterTest.cs =================================================================== diff -u -rec5eeafbbd987b02a9d9c07b7e920c03d567f3f7 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/LognormalDistributionDesignVariableTypeConverterTest.cs (.../LognormalDistributionDesignVariableTypeConverterTest.cs) (revision ec5eeafbbd987b02a9d9c07b7e920c03d567f3f7) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/LognormalDistributionDesignVariableTypeConverterTest.cs (.../LognormalDistributionDesignVariableTypeConverterTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -8,7 +8,6 @@ using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Probabilistics; using Ringtoets.Piping.Data; Fisheye: Tag 6f069737c5a49402fc344e4f7e350c6d869b69f2 refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismResultViewTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder1DTest.cs =================================================================== diff -u -rbf334f50530164badedba45a78f3aab857ae1bf6 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder1DTest.cs (.../SoilProfileBuilder1DTest.cs) (revision bf334f50530164badedba45a78f3aab857ae1bf6) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder1DTest.cs (.../SoilProfileBuilder1DTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,7 +1,6 @@ using System; using System.Linq; using NUnit.Framework; -using Ringtoets.Piping.Data; using Ringtoets.Piping.IO.Builders; using Ringtoets.Piping.Primitives; Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder2DTest.cs =================================================================== diff -u -rbf334f50530164badedba45a78f3aab857ae1bf6 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder2DTest.cs (.../SoilProfileBuilder2DTest.cs) (revision bf334f50530164badedba45a78f3aab857ae1bf6) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder2DTest.cs (.../SoilProfileBuilder2DTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -3,7 +3,6 @@ using System.Linq; using Core.Common.Base.Geometry; using NUnit.Framework; -using Ringtoets.Piping.Data; using Ringtoets.Piping.Data.TestUtil; using Ringtoets.Piping.IO.Builders; using Ringtoets.Piping.IO.Properties; Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/SoilLayer2DReaderTest.cs =================================================================== diff -u -rdd7a5cfb0343fa2350b4143232b94cbba37612e9 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/SoilLayer2DReaderTest.cs (.../SoilLayer2DReaderTest.cs) (revision dd7a5cfb0343fa2350b4143232b94cbba37612e9) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/SoilLayer2DReaderTest.cs (.../SoilLayer2DReaderTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -7,7 +7,6 @@ using Core.Common.Base.Geometry; using NUnit.Framework; -using Ringtoets.Piping.Data; using Ringtoets.Piping.IO.Builders; using Ringtoets.Piping.IO.Properties; using Ringtoets.Piping.IO.SoilProfile; Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SurfaceLines/CharacteristicPointsCsvReaderTest.cs =================================================================== diff -u -rcd17802422ec70791daa96e1f536bf505ecfe954 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SurfaceLines/CharacteristicPointsCsvReaderTest.cs (.../CharacteristicPointsCsvReaderTest.cs) (revision cd17802422ec70791daa96e1f536bf505ecfe954) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SurfaceLines/CharacteristicPointsCsvReaderTest.cs (.../CharacteristicPointsCsvReaderTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -5,7 +5,6 @@ using Core.Common.TestUtil; using Core.Common.Utils.Builders; using NUnit.Framework; -using Ringtoets.Piping.IO.Exceptions; using Ringtoets.Piping.IO.Properties; using Ringtoets.Piping.IO.SurfaceLines; using UtilsResources = Core.Common.Utils.Properties.Resources; Fisheye: Tag 64d5609bb2912cd52dc74deffdd189222e240599 refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/FailureMechanismResultViewIntegrationTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/ImportSoilProfileFromDatabaseTest.cs =================================================================== diff -u -rb1c2f3f896147de67d46fde3bce9098d94054037 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/ImportSoilProfileFromDatabaseTest.cs (.../ImportSoilProfileFromDatabaseTest.cs) (revision b1c2f3f896147de67d46fde3bce9098d94054037) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/ImportSoilProfileFromDatabaseTest.cs (.../ImportSoilProfileFromDatabaseTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -26,7 +26,6 @@ using Deltares.WTIPiping; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Piping.Data; using Ringtoets.Piping.Forms.PresentationObjects; Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/PipingFailureMechanismResultViewIntegrationTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/PipingFailureMechanismResultViewIntegrationTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/PipingFailureMechanismResultViewIntegrationTest.cs (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -0,0 +1,171 @@ +// Copyright (C) Stichting Deltares 2016. 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.Globalization; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Base.Data; +using NUnit.Extensions.Forms; +using NUnit.Framework; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Integration.Data; +using Ringtoets.Piping.Data; +using Ringtoets.Piping.Forms.Views; +using Ringtoets.Piping.Service; + +namespace Ringtoets.Piping.Integration.Test +{ + [TestFixture] + public class PipingFailureMechanismResultViewIntegrationTest + { + [Test] + public void FailureMechanismResultView_DataImportedOrChanged_ChangesCorrectlyObservedAndSynced() + { + using (var form = new Form()) + { + // Show the view + var failureMechanismResultView = new PipingFailureMechanismResultView(); + form.Controls.Add(failureMechanismResultView); + form.Show(); + + // Obtain the data grid view + var dataGridView = (DataGridView)new ControlTester("dataGridView").TheObject; + + // Set all necessary data to the view + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); + failureMechanismResultView.Data = assessmentSection.PipingFailureMechanism.SectionResults; + failureMechanismResultView.FailureMechanism = assessmentSection.PipingFailureMechanism; + + // Import failure mechanisn sections and ensure the data grid view is updated + IntegrationTestHelper.ImportReferenceLine(assessmentSection); + IntegrationTestHelper.ImportFailureMechanismSections(assessmentSection, assessmentSection.PipingFailureMechanism); + Assert.AreEqual(283, dataGridView.Rows.Count); + Assert.AreEqual("-", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual(string.Empty, dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); + + // Import surface lines + IntegrationTestHelper.ImportSurfaceLines(assessmentSection); + + // Setup some calculations + var pipingCalculation1 = new PipingCalculationScenario(new GeneralPipingInput(), new NormProbabilityPipingInput()) + { + InputParameters = + { + SurfaceLine = assessmentSection.PipingFailureMechanism.SurfaceLines.First(sl => sl.Name == "PK001_0001") + } + }; + var pipingCalculation2 = new PipingCalculationScenario(new GeneralPipingInput(), new NormProbabilityPipingInput()) + { + InputParameters = + { + SurfaceLine = assessmentSection.PipingFailureMechanism.SurfaceLines.First(sl => sl.Name == "PK001_0001") + } + }; + + // Add a piping calculation and ensure it is shown in the data grid view + assessmentSection.PipingFailureMechanism.CalculationsGroup.Children.Add(pipingCalculation1); + assessmentSection.PipingFailureMechanism.CalculationsGroup.NotifyObservers(); + assessmentSection.PipingFailureMechanism.CalculationsGroup.AddCalculationScenariosToFailureMechanismSectionResult(assessmentSection.PipingFailureMechanism); + Assert.AreEqual("-", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("Niet alle berekeningen voor dit vak zijn uitgevoerd.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); + + // Add group and ensure the data grid view is not changed + var nestedPipingCalculationGroup = new CalculationGroup("New group", false); + assessmentSection.PipingFailureMechanism.CalculationsGroup.Children.Add(nestedPipingCalculationGroup); + assessmentSection.PipingFailureMechanism.CalculationsGroup.NotifyObservers(); + Assert.AreEqual("-", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("Niet alle berekeningen voor dit vak zijn uitgevoerd.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); + + // Add another, nested calculation and ensure the data grid view is updated + nestedPipingCalculationGroup.Children.Add(pipingCalculation2); + nestedPipingCalculationGroup.NotifyObservers(); + assessmentSection.PipingFailureMechanism.CalculationsGroup.AddCalculationScenariosToFailureMechanismSectionResult(assessmentSection.PipingFailureMechanism); + Assert.AreEqual(double.NaN.ToString(CultureInfo.InvariantCulture), dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("Bijdrage van de geselecteerde scenario's voor dit vak is opgeteld niet gelijk aan 100%.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); + + // Set the second calculation to not relevant and ensure the data grid view is updated + pipingCalculation2.IsRelevant = false; + pipingCalculation2.NotifyObservers(); + Assert.AreEqual("-", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("Niet alle berekeningen voor dit vak zijn uitgevoerd.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); + + // Execute the first calculation and ensure the data grid view is updated + const double probability = 31846382; + pipingCalculation1.Output = new PipingOutput(0, 0, 0, 0, 0, 0); + pipingCalculation1.SemiProbabilisticOutput = new PipingSemiProbabilisticOutput(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, probability, 0, 0); + pipingCalculation1.NotifyObservers(); + Assert.AreEqual(string.Format("1/{0:N0}", pipingCalculation1.Probability), dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual(string.Empty, dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); + + // Add another, nested calculation without surface line and ensure the data grid view is updated when the surface line is set + var pipingCalculation3 = new PipingCalculationScenario(new GeneralPipingInput(), new NormProbabilityPipingInput()); + nestedPipingCalculationGroup.Children.Add(pipingCalculation3); + nestedPipingCalculationGroup.NotifyObservers(); + assessmentSection.PipingFailureMechanism.CalculationsGroup.AddCalculationScenariosToFailureMechanismSectionResult(assessmentSection.PipingFailureMechanism); + Assert.AreEqual(string.Format("1/{0:N0}", pipingCalculation1.Probability), dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual(string.Empty, dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); + + pipingCalculation3.InputParameters.SurfaceLine = assessmentSection.PipingFailureMechanism.SurfaceLines.First(sl => sl.Name == "PK001_0001"); + PipingCalculationScenarioService.SyncCalculationScenarioWithNewSurfaceLine(pipingCalculation3, assessmentSection.PipingFailureMechanism, null); + pipingCalculation3.InputParameters.NotifyObservers(); + Assert.AreEqual(double.NaN.ToString(CultureInfo.InvariantCulture), dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("Bijdrage van de geselecteerde scenario's voor dit vak is opgeteld niet gelijk aan 100%.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); + + // Change the contribution of the calculation and make sure the data grid view is updated + pipingCalculation3.Contribution = (RoundedDouble) 0.3; + pipingCalculation3.NotifyObservers(); + Assert.AreEqual(double.NaN.ToString(CultureInfo.InvariantCulture), dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("Bijdrage van de geselecteerde scenario's voor dit vak is opgeteld niet gelijk aan 100%.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); + + pipingCalculation1.Contribution = (RoundedDouble) 0.7; + pipingCalculation1.NotifyObservers(); + Assert.AreEqual("-", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("Niet alle berekeningen voor dit vak zijn uitgevoerd.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); + + // Remove a calculation and make sure the data grid view is updated + nestedPipingCalculationGroup.Children.Remove(pipingCalculation3); + PipingCalculationScenarioService.RemoveCalculationScenarioFromSectionResult(pipingCalculation3, assessmentSection.PipingFailureMechanism); + nestedPipingCalculationGroup.NotifyObservers(); + Assert.AreEqual(double.NaN.ToString(CultureInfo.InvariantCulture), dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("Bijdrage van de geselecteerde scenario's voor dit vak is opgeteld niet gelijk aan 100%.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); + + // Set contribution again so we have a probability. + pipingCalculation1.Contribution = (RoundedDouble) 1.0; + pipingCalculation1.NotifyObservers(); + Assert.AreEqual(string.Format("1/{0:N0}", pipingCalculation1.Probability), dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual(string.Empty, dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); + + // Clear the output of the calculation and make sure the data grid view is updated + pipingCalculation1.ClearOutput(); + pipingCalculation1.NotifyObservers(); + Assert.AreEqual("-", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("Niet alle berekeningen voor dit vak zijn uitgevoerd.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); + } + } + + private const int nameColumnIndex = 0; + private const int assessmentLayerOneIndex = 1; + private const int assessmentLayerTwoAIndex = 2; + private const int assessmentLayerTwoBIndex = 3; + private const int assessmentLayerThreeIndex = 4; + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/Ringtoets.Piping.Integration.Test.csproj =================================================================== diff -u -rb1c2f3f896147de67d46fde3bce9098d94054037 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/Ringtoets.Piping.Integration.Test.csproj (.../Ringtoets.Piping.Integration.Test.csproj) (revision b1c2f3f896147de67d46fde3bce9098d94054037) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/Ringtoets.Piping.Integration.Test.csproj (.../Ringtoets.Piping.Integration.Test.csproj) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -65,7 +65,7 @@ - + Index: Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingCalculatorInputTest.cs =================================================================== diff -u -rbf334f50530164badedba45a78f3aab857ae1bf6 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingCalculatorInputTest.cs (.../PipingCalculatorInputTest.cs) (revision bf334f50530164badedba45a78f3aab857ae1bf6) +++ Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingCalculatorInputTest.cs (.../PipingCalculatorInputTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,6 +1,5 @@ using System; using NUnit.Framework; -using Ringtoets.Piping.Data; using Ringtoets.Piping.Primitives; namespace Ringtoets.Piping.KernelWrapper.Test Index: Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingProfileCreatorTest.cs =================================================================== diff -u -rbf334f50530164badedba45a78f3aab857ae1bf6 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingProfileCreatorTest.cs (.../PipingProfileCreatorTest.cs) (revision bf334f50530164badedba45a78f3aab857ae1bf6) +++ Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingProfileCreatorTest.cs (.../PipingProfileCreatorTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -4,7 +4,6 @@ using System.Linq; using Deltares.WTIPiping; using NUnit.Framework; -using Ringtoets.Piping.Data; using Ringtoets.Piping.Primitives; namespace Ringtoets.Piping.KernelWrapper.Test Index: Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.TestUtil/TestPipingInput.cs =================================================================== diff -u -rbf334f50530164badedba45a78f3aab857ae1bf6 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.TestUtil/TestPipingInput.cs (.../TestPipingInput.cs) (revision bf334f50530164badedba45a78f3aab857ae1bf6) +++ Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.TestUtil/TestPipingInput.cs (.../TestPipingInput.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -1,7 +1,6 @@ using System; using Core.Common.Base.Data; using Core.Common.Base.Geometry; -using Ringtoets.Piping.Data; using Ringtoets.Piping.Primitives; namespace Ringtoets.Piping.KernelWrapper.TestUtil Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs =================================================================== diff -u -r23a37b025a5d0358c1f30fb31de41a2c284519a5 -r64d5609bb2912cd52dc74deffdd189222e240599 --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision 23a37b025a5d0358c1f30fb31de41a2c284519a5) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Collections.Generic; using System.Linq; using Core.Common.Base.Plugin; using Core.Common.Controls.TreeView; @@ -28,6 +29,7 @@ using Core.Common.Gui.Plugin; using NUnit.Framework; using Rhino.Mocks; +using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Piping.Data; using Ringtoets.Piping.Forms.PresentationObjects; using Ringtoets.Piping.Forms.PropertyClasses; @@ -144,7 +146,7 @@ TreeNodeInfo[] treeNodeInfos = guiPlugin.GetTreeNodeInfos().ToArray(); // assert - Assert.AreEqual(12, treeNodeInfos.Length); + Assert.AreEqual(13, treeNodeInfos.Length); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(RingtoetsPipingSurfaceLinesContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(RingtoetsPipingSurfaceLine))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StochasticSoilModelContext))); @@ -154,6 +156,7 @@ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingCalculationGroupContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingInputContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingFailureMechanismContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingSemiProbabilisticOutput))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(EmptyPipingOutput))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(EmptyPipingCalculationReport))); @@ -184,10 +187,11 @@ ViewInfo[] viewInfos = guiPlugin.GetViewInfos().ToArray(); // Assert - Assert.AreEqual(2, viewInfos.Length); + Assert.AreEqual(3, viewInfos.Length); Assert.IsTrue(viewInfos.Any(vi => vi.ViewType == typeof(PipingFailureMechanismView))); Assert.IsTrue(viewInfos.Any(vi => vi.ViewType == typeof(PipingCalculationsView))); + Assert.IsTrue(viewInfos.Any(vi => vi.ViewType == typeof(PipingFailureMechanismResultView))); } } }