Index: Ringtoets/Common/test/Ringtoets.Common.Plugin.Test/RingtoetsPluginHelperTest.cs =================================================================== diff -u -re4310a61841a0e3cefc1854f6d3f998f825e923b -rde35bf7f0d2f9716d6f9426e83aa1007db9f0900 --- Ringtoets/Common/test/Ringtoets.Common.Plugin.Test/RingtoetsPluginHelperTest.cs (.../RingtoetsPluginHelperTest.cs) (revision e4310a61841a0e3cefc1854f6d3f998f825e923b) +++ Ringtoets/Common/test/Ringtoets.Common.Plugin.Test/RingtoetsPluginHelperTest.cs (.../RingtoetsPluginHelperTest.cs) (revision de35bf7f0d2f9716d6f9426e83aa1007db9f0900) @@ -19,20 +19,14 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System.Linq; +using Core.Common.Base; using Core.Common.Controls.Views; using NUnit.Framework; -using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.FailureMechanism; -using Ringtoets.Common.Data.Structures; -using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.PresentationObjects; -using Ringtoets.Common.Forms.Views; -using Ringtoets.HeightStructures.Data; -using Ringtoets.HeightStructures.Forms.PresentationObjects; -using Ringtoets.Integration.Data; -using Ringtoets.Integration.Plugin; +using Ringtoets.Common.Plugin; namespace Ringtoets.Common.Service.Test { @@ -41,60 +35,86 @@ { protected override bool PerformShouldCloseViewWithCalculationDataMethod(IView view, object o) { - using (var plugin = new RingtoetsPlugin()) - { - return plugin.GetViewInfos() - .First(tni => tni.ViewType == typeof(GeneralResultFaultTreeIllustrationPointView)) - .CloseForData(view, o); - } + return RingtoetsPluginHelper.ShouldCloseViewWithCalculationData(view, o); } protected override IView GetView() { - return new GeneralResultFaultTreeIllustrationPointView(() => new TestGeneralResultFaultTreeIllustrationPoint()); + return new TestView(); } protected override ICalculation GetCalculation() { - return new StructuresCalculation(); + return new TestCalculation("Calculation"); } protected override ICalculationContext GetCalculationContextWithCalculation() { - return new HeightStructuresCalculationContext( - new StructuresCalculation(), - new HeightStructuresFailureMechanism(), - new AssessmentSection(AssessmentSectionComposition.Dike)); + return new TestCalculationContext(); } protected override ICalculationContext GetCalculationGroupContextWithCalculation() { - return new HeightStructuresCalculationGroupContext( - new CalculationGroup + return new TestCalculationGroupContext(); + } + + protected override IFailureMechanismContext GetFailureMechanismContextWithCalculation() + { + return new TestFailureMechanismContext(); + } + + private class TestView : IView + { + public object Data { get; set; } + + public string Text { get; set; } + + public void Dispose() {} + } + + private class TestCalculationContext : Observable, ICalculationContext + { + public TestCalculationContext() + { + WrappedData = new TestCalculation("Calculation"); + FailureMechanism = new TestFailureMechanism(); + } + + public TestCalculation WrappedData { get; } + + public TestFailureMechanism FailureMechanism { get; } + } + + private class TestCalculationGroupContext : Observable, ICalculationContext + { + public TestCalculationGroupContext() + { + WrappedData = new CalculationGroup { Children = { - new StructuresCalculation() + new TestCalculation("Calculation") } - }, - new HeightStructuresFailureMechanism(), - new AssessmentSection(AssessmentSectionComposition.Dike)); + }; + FailureMechanism = new TestFailureMechanism(); + } + + public CalculationGroup WrappedData { get; } + + public TestFailureMechanism FailureMechanism { get; } } - protected override IFailureMechanismContext GetFailureMechanismContextWithCalculation() + private class TestFailureMechanismContext : Observable, IFailureMechanismContext { - return new HeightStructuresFailureMechanismContext( - new HeightStructuresFailureMechanism + public TestFailureMechanismContext() + { + WrappedData = new TestFailureMechanism(new[] { - CalculationsGroup = - { - Children = - { - new StructuresCalculation() - } - } - }, - new AssessmentSection(AssessmentSectionComposition.Dike)); + new TestCalculation("Calculation") + }); + } + + public TestFailureMechanism WrappedData { get; } } } } \ No newline at end of file