Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Handlers/AssessmentSectionCompositionChangeHandlerTest.cs =================================================================== diff -u -r1e812d631cafdf6ea8433576e2d9f2f40d019dfd -r21ded87c36d9ef4309ae4b85dc60b67358b1e1c2 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Handlers/AssessmentSectionCompositionChangeHandlerTest.cs (.../AssessmentSectionCompositionChangeHandlerTest.cs) (revision 1e812d631cafdf6ea8433576e2d9f2f40d019dfd) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Handlers/AssessmentSectionCompositionChangeHandlerTest.cs (.../AssessmentSectionCompositionChangeHandlerTest.cs) (revision 21ded87c36d9ef4309ae4b85dc60b67358b1e1c2) @@ -99,6 +99,7 @@ AssessmentSection assessmentSection = TestDataGenerator.GetAssessmentSectionWithAllCalculationConfigurations(); AssessmentSectionComposition originalComposition = assessmentSection.Composition; ICalculation[] calculationsWithOutput = assessmentSection.GetFailureMechanisms() + .OfType() .SelectMany(fm => fm.Calculations) .Where(c => c.HasOutput) .ToArray(); Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Handlers/HydraulicBoundaryDatabaseUpdateHandlerTest.cs =================================================================== diff -u -r8008460b1ddb7d50e8d4d31a118f32ea0fc8b979 -r21ded87c36d9ef4309ae4b85dc60b67358b1e1c2 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Handlers/HydraulicBoundaryDatabaseUpdateHandlerTest.cs (.../HydraulicBoundaryDatabaseUpdateHandlerTest.cs) (revision 8008460b1ddb7d50e8d4d31a118f32ea0fc8b979) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Handlers/HydraulicBoundaryDatabaseUpdateHandlerTest.cs (.../HydraulicBoundaryDatabaseUpdateHandlerTest.cs) (revision 21ded87c36d9ef4309ae4b85dc60b67358b1e1c2) @@ -29,6 +29,7 @@ using Rhino.Mocks; using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.Calculation; +using Riskeer.Common.Data.FailureMechanism; using Riskeer.Common.Data.Hydraulics; using Riskeer.Common.Data.TestUtil; using Riskeer.DuneErosion.Plugin.Handlers; @@ -821,6 +822,7 @@ AssessmentSection assessmentSection = TestDataGenerator.GetAssessmentSectionWithAllCalculationConfigurations(); ICalculation[] calculationsWithOutput = assessmentSection.GetFailureMechanisms() + .OfType() .SelectMany(fm => fm.Calculations) .Where(c => c.HasOutput) .ToArray(); Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Handlers/HydraulicLocationConfigurationDatabaseUpdateHandlerTest.cs =================================================================== diff -u -r4b889a77a0b2a44d9eadc54540334140415177c8 -r21ded87c36d9ef4309ae4b85dc60b67358b1e1c2 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Handlers/HydraulicLocationConfigurationDatabaseUpdateHandlerTest.cs (.../HydraulicLocationConfigurationDatabaseUpdateHandlerTest.cs) (revision 4b889a77a0b2a44d9eadc54540334140415177c8) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Handlers/HydraulicLocationConfigurationDatabaseUpdateHandlerTest.cs (.../HydraulicLocationConfigurationDatabaseUpdateHandlerTest.cs) (revision 21ded87c36d9ef4309ae4b85dc60b67358b1e1c2) @@ -28,6 +28,7 @@ using NUnit.Framework; using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.Calculation; +using Riskeer.Common.Data.FailureMechanism; using Riskeer.Common.Data.Hydraulics; using Riskeer.DuneErosion.Data; using Riskeer.HydraRing.IO.HydraulicLocationConfigurationDatabase; @@ -220,6 +221,7 @@ IEnumerable locations = GetLocationCalculations(assessmentSection); IEnumerable duneLocations = GetDuneLocationCalculations(assessmentSection); ICalculation[] calculationsWithOutput = assessmentSection.GetFailureMechanisms() + .OfType() .SelectMany(fm => fm.Calculations) .Where(c => c.HasOutput) .ToArray(); Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/CommentViewInfoTest.cs =================================================================== diff -u -ra904f682c476b8f86ff235286a39d8b74d723913 -r21ded87c36d9ef4309ae4b85dc60b67358b1e1c2 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/CommentViewInfoTest.cs (.../CommentViewInfoTest.cs) (revision a904f682c476b8f86ff235286a39d8b74d723913) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/CommentViewInfoTest.cs (.../CommentViewInfoTest.cs) (revision 21ded87c36d9ef4309ae4b85dc60b67358b1e1c2) @@ -96,10 +96,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = comment + }) { - Data = comment - }) - { // Call bool closeForData = info.CloseForData(view, new object()); @@ -120,10 +120,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = assessmentSection.Comments + }) { - Data = assessmentSection.Comments - }) - { // Call bool closeForData = info.CloseForData(view, assessmentSection); @@ -149,10 +149,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = viewDataAssessmentSection.Comments + }) { - Data = viewDataAssessmentSection.Comments - }) - { // Call bool closeForData = info.CloseForData(view, deletedAssessmentSection); @@ -170,7 +170,7 @@ var calculation = mocks.Stub(); calculation.Stub(s => s.Comments).Return(new Comment()); - var failureMechanism = mocks.Stub(); + var failureMechanism = mocks.Stub(); failureMechanism.Stub(fm => fm.Calculations).Return(new[] { calculation @@ -189,10 +189,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = calculation.Comments + }) { - Data = calculation.Comments - }) - { // Call bool closeForData = info.CloseForData(view, assessmentSection); @@ -209,7 +209,7 @@ // Setup var viewDataComment = new Comment(); - var failureMechanism = mocks.Stub(); + var failureMechanism = mocks.Stub(); failureMechanism.Stub(fm => fm.Calculations).Return(Enumerable.Empty()); failureMechanism.Stub(fm => fm.InAssemblyInputComments).Return(new Comment()); failureMechanism.Stub(fm => fm.InAssemblyOutputComments).Return(new Comment()); @@ -226,10 +226,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = viewDataComment + }) { - Data = viewDataComment - }) - { // Call bool closeForData = info.CloseForData(view, assessmentSection); @@ -249,7 +249,7 @@ var deletedCalculation = mocks.Stub(); - var deletedFailureMechanism = mocks.Stub(); + var deletedFailureMechanism = mocks.Stub(); deletedFailureMechanism.Stub(fm => fm.Calculations).Return(new[] { deletedCalculation @@ -269,10 +269,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = viewDataCalculation.Comments + }) { - Data = viewDataCalculation.Comments - }) - { // Call bool closeForData = info.CloseForData(view, deletedAssessmentSection); @@ -289,7 +289,7 @@ // Setup var comment = new Comment(); - var failureMechanism = mocks.Stub(); + var failureMechanism = mocks.Stub(); failureMechanism.Stub(fm => fm.Calculations).Return(Enumerable.Empty()); failureMechanism.Stub(fm => fm.InAssemblyInputComments).Return(comment); failureMechanism.Stub(fm => fm.InAssemblyOutputComments).Return(new Comment()); @@ -304,10 +304,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = comment + }) { - Data = comment - }) - { // Call bool closeForData = info.CloseForData(view, assessmentSection); @@ -324,7 +324,7 @@ // Setup var comment = new Comment(); - var failureMechanism = mocks.Stub(); + var failureMechanism = mocks.Stub(); failureMechanism.Stub(fm => fm.Calculations).Return(Enumerable.Empty()); failureMechanism.Stub(fm => fm.InAssemblyInputComments).Return(new Comment()); failureMechanism.Stub(fm => fm.InAssemblyOutputComments).Return(comment); @@ -339,10 +339,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = comment + }) { - Data = comment - }) - { // Call bool closeForData = info.CloseForData(view, assessmentSection); @@ -359,7 +359,7 @@ // Setup var comment = new Comment(); - var failureMechanism = mocks.Stub(); + var failureMechanism = mocks.Stub(); failureMechanism.Stub(fm => fm.Calculations).Return(Enumerable.Empty()); failureMechanism.Stub(fm => fm.InAssemblyInputComments).Return(new Comment()); failureMechanism.Stub(fm => fm.InAssemblyOutputComments).Return(new Comment()); @@ -374,10 +374,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = comment + }) { - Data = comment - }) - { // Call bool closeForData = info.CloseForData(view, assessmentSection); @@ -394,7 +394,7 @@ // Setup var comment = new Comment(); - var failureMechanism = mocks.Stub(); + var failureMechanism = mocks.Stub(); failureMechanism.Stub(fm => fm.Calculations).Return(Enumerable.Empty()); failureMechanism.Stub(fm => fm.InAssemblyInputComments).Return(new Comment()); failureMechanism.Stub(fm => fm.InAssemblyOutputComments).Return(new Comment()); @@ -410,10 +410,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = comment + }) { - Data = comment - }) - { // Call bool closeForData = info.CloseForData(view, assessmentSection); @@ -423,14 +423,14 @@ mocks.VerifyAll(); } - + [Test] public void CloseForData_ViewDataIsCommentButNotOfDeletedFailureMechanism_ReturnFalse() { // Setup var viewDataComment = new Comment(); - var failureMechanism = mocks.Stub(); + var failureMechanism = mocks.Stub(); failureMechanism.Stub(fm => fm.Calculations).Return(Enumerable.Empty()); failureMechanism.Stub(fm => fm.InAssemblyInputComments).Return(new Comment()); failureMechanism.Stub(fm => fm.InAssemblyOutputComments).Return(new Comment()); @@ -440,10 +440,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = viewDataComment + }) { - Data = viewDataComment - }) - { // Call bool closeForData = info.CloseForData(view, failureMechanism); @@ -471,10 +471,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = viewDataComment.InAssemblyInputComments + }) { - Data = viewDataComment.InAssemblyInputComments - }) - { // Call bool closeForData = info.CloseForData(view, deletedAssessmentSection); @@ -502,10 +502,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = getCommentFunc(failurePath) + }) { - Data = getCommentFunc(failurePath) - }) - { // Call bool closeForData = info.CloseForData(view, assessmentSection); @@ -531,10 +531,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = affectedComment + }) { - Data = affectedComment - }) - { // Call bool closeForData = info.CloseForData(view, failurePathContext); @@ -561,10 +561,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = unaffectedComment + }) { - Data = unaffectedComment - }) - { // Call bool closeForData = info.CloseForData(view, failurePathContext); @@ -587,10 +587,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = viewDataCalculation.Comments + }) { - Data = viewDataCalculation.Comments - }) - { // Call bool closeForData = info.CloseForData(view, deletedCalculationContext); @@ -616,10 +616,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = viewDataCalculation.Comments + }) { - Data = viewDataCalculation.Comments - }) - { // Call bool closeForData = info.CloseForData(view, deletedCalculationContext); @@ -650,10 +650,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = viewDataCalculation.Comments + }) { - Data = viewDataCalculation.Comments - }) - { // Call bool closeForData = info.CloseForData(view, deletedGroupContext); @@ -686,10 +686,10 @@ mocks.ReplayAll(); using (var view = new CommentView + { + Data = viewDataCalculation.Comments + }) { - Data = viewDataCalculation.Comments - }) - { // Call bool closeForData = info.CloseForData(view, deletedGroupContext); Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/GeneralResultFaultTreeIllustrationPointViewInfoTest.cs =================================================================== diff -u -r013435ed49ecc69ce2a584e37c9d0d7039fa6a7b -r21ded87c36d9ef4309ae4b85dc60b67358b1e1c2 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/GeneralResultFaultTreeIllustrationPointViewInfoTest.cs (.../GeneralResultFaultTreeIllustrationPointViewInfoTest.cs) (revision 013435ed49ecc69ce2a584e37c9d0d7039fa6a7b) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/GeneralResultFaultTreeIllustrationPointViewInfoTest.cs (.../GeneralResultFaultTreeIllustrationPointViewInfoTest.cs) (revision 21ded87c36d9ef4309ae4b85dc60b67358b1e1c2) @@ -164,7 +164,7 @@ new AssessmentSection(AssessmentSectionComposition.Dike)); } - protected override IFailureMechanism GetFailureMechanismWithCalculation() + protected override ICalculatableFailureMechanism GetFailureMechanismWithCalculation() { return new HeightStructuresFailureMechanism { @@ -211,7 +211,7 @@ new AssessmentSection(AssessmentSectionComposition.Dike)); } - protected override IFailureMechanism GetFailureMechanismWithCalculation() + protected override ICalculatableFailureMechanism GetFailureMechanismWithCalculation() { return new ClosingStructuresFailureMechanism @@ -259,7 +259,7 @@ new AssessmentSection(AssessmentSectionComposition.Dike)); } - protected override IFailureMechanism GetFailureMechanismWithCalculation() + protected override ICalculatableFailureMechanism GetFailureMechanismWithCalculation() { return new StabilityPointStructuresFailureMechanism { Index: Riskeer/Revetment/src/Riskeer.Revetment.Service/WaveConditionsDataSynchronizationService.cs =================================================================== diff -u -r6044ea132c4c7e98cb6e08bad7e939a9fa460459 -r21ded87c36d9ef4309ae4b85dc60b67358b1e1c2 --- Riskeer/Revetment/src/Riskeer.Revetment.Service/WaveConditionsDataSynchronizationService.cs (.../WaveConditionsDataSynchronizationService.cs) (revision 6044ea132c4c7e98cb6e08bad7e939a9fa460459) +++ Riskeer/Revetment/src/Riskeer.Revetment.Service/WaveConditionsDataSynchronizationService.cs (.../WaveConditionsDataSynchronizationService.cs) (revision 21ded87c36d9ef4309ae4b85dc60b67358b1e1c2) @@ -44,15 +44,15 @@ /// /// The failure mechanism which contains the calculations. /// The to clear for. - /// The type of the failure mechanism. + /// The type of the calculatable failure mechanism. /// The type of the calculation. /// An of calculations which are affected by clearing the output. /// Thrown when is null. /// Thrown when is invalid. /// Thrown when is not supported. public static IEnumerable ClearAllWaveConditionsCalculationOutput( TFailureMechanism failureMechanism, NormType normType) - where TFailureMechanism : IFailureMechanism + where TFailureMechanism : ICalculatableFailureMechanism where TCalculation : ICalculation { if (failureMechanism == null) @@ -80,13 +80,13 @@ /// The failure mechanism which contains the calculations. /// The /// to clear for. - /// The type of the failure mechanism. + /// The type of the calculatable failure mechanism. /// The type of the calculation. /// An of calculations which are affected by clearing the output. /// Thrown when any parameter is null. public static IEnumerable ClearAllWaveConditionsCalculationOutput( TFailureMechanism failureMechanism, HydraulicBoundaryLocationCalculationsForTargetProbability calculationsForTargetProbability) - where TFailureMechanism : IFailureMechanism + where TFailureMechanism : ICalculatableFailureMechanism where TCalculation : ICalculation { if (failureMechanism == null) @@ -118,13 +118,13 @@ /// The failure mechanism which contains the calculations. /// The /// to clear for. - /// The type of the failure mechanism. + /// The type of the calculatable failure mechanism. /// The type of the calculation. /// An of calculations which are affected by clearing the output. /// Thrown when any parameter is null. public static IEnumerable ClearWaveConditionsCalculationOutputAndRemoveTargetProbability( TFailureMechanism failureMechanism, HydraulicBoundaryLocationCalculationsForTargetProbability calculationsForTargetProbability) - where TFailureMechanism : IFailureMechanism + where TFailureMechanism : ICalculatableFailureMechanism where TCalculation : ICalculation { if (failureMechanism == null) Index: Riskeer/Revetment/test/Riskeer.Revetment.Service.Test/WaveConditionsDataSynchronizationServiceTest.cs =================================================================== diff -u -r6044ea132c4c7e98cb6e08bad7e939a9fa460459 -r21ded87c36d9ef4309ae4b85dc60b67358b1e1c2 --- Riskeer/Revetment/test/Riskeer.Revetment.Service.Test/WaveConditionsDataSynchronizationServiceTest.cs (.../WaveConditionsDataSynchronizationServiceTest.cs) (revision 6044ea132c4c7e98cb6e08bad7e939a9fa460459) +++ Riskeer/Revetment/test/Riskeer.Revetment.Service.Test/WaveConditionsDataSynchronizationServiceTest.cs (.../WaveConditionsDataSynchronizationServiceTest.cs) (revision 21ded87c36d9ef4309ae4b85dc60b67358b1e1c2) @@ -44,7 +44,7 @@ public void ClearAllWaveConditionsCalculationOutputWithNormType_FailureMechanismNull_ThrowsArgumentNullException() { // Call - void Call() => WaveConditionsDataSynchronizationService.ClearAllWaveConditionsCalculationOutput>( + void Call() => WaveConditionsDataSynchronizationService.ClearAllWaveConditionsCalculationOutput>( null, NormType.SignalFloodingProbability); // Assert @@ -59,7 +59,7 @@ const NormType normType = (NormType) 99; // Call - void Call() => WaveConditionsDataSynchronizationService.ClearAllWaveConditionsCalculationOutput>( + void Call() => WaveConditionsDataSynchronizationService.ClearAllWaveConditionsCalculationOutput>( new TestFailureMechanism(), normType); // Assert @@ -92,7 +92,7 @@ }, true); var mocks = new MockRepository(); - var failureMechanism = mocks.Stub(); + var failureMechanism = mocks.Stub(); failureMechanism.Stub(fm => fm.Calculations).Return(new[] { calculation1, @@ -110,7 +110,7 @@ }; // Call - IEnumerable affectedCalculations = WaveConditionsDataSynchronizationService.ClearAllWaveConditionsCalculationOutput>( + IEnumerable affectedCalculations = WaveConditionsDataSynchronizationService.ClearAllWaveConditionsCalculationOutput>( failureMechanism, normType); // Assert @@ -124,7 +124,7 @@ public void ClearAllWaveConditionsCalculationsOutputWithUserDefinedTargetProbability_FailureMechanismNull_ThrowsArgumentNullException() { // Call - void Call() => WaveConditionsDataSynchronizationService.ClearAllWaveConditionsCalculationOutput>( + void Call() => WaveConditionsDataSynchronizationService.ClearAllWaveConditionsCalculationOutput>( null, new HydraulicBoundaryLocationCalculationsForTargetProbability(0.1)); // Assert @@ -136,7 +136,7 @@ public void ClearAllWaveConditionsCalculationsOutputWithUserDefinedTargetProbability_CalculationsForTargetProbabilityNull_ThrowsArgumentNullException() { // Call - void Call() => WaveConditionsDataSynchronizationService.ClearAllWaveConditionsCalculationOutput>( + void Call() => WaveConditionsDataSynchronizationService.ClearAllWaveConditionsCalculationOutput>( new TestFailureMechanism(), null); // Assert @@ -178,7 +178,7 @@ }, true); var mocks = new MockRepository(); - var failureMechanism = mocks.Stub(); + var failureMechanism = mocks.Stub(); failureMechanism.Stub(fm => fm.Calculations).Return(new[] { calculation1, @@ -195,7 +195,7 @@ }; // Call - IEnumerable affectedCalculations = WaveConditionsDataSynchronizationService.ClearAllWaveConditionsCalculationOutput>( + IEnumerable affectedCalculations = WaveConditionsDataSynchronizationService.ClearAllWaveConditionsCalculationOutput>( failureMechanism, calculationsForTargetProbabilityToClear); // Assert @@ -209,7 +209,7 @@ public void ClearWaveConditionsCalculationOutputAndRemoveTargetProbability_FailureMechanismNull_ThrowsArgumentNullException() { // Call - void Call() => WaveConditionsDataSynchronizationService.ClearWaveConditionsCalculationOutputAndRemoveTargetProbability>( + void Call() => WaveConditionsDataSynchronizationService.ClearWaveConditionsCalculationOutputAndRemoveTargetProbability>( null, new HydraulicBoundaryLocationCalculationsForTargetProbability(0.1)); // Assert @@ -221,7 +221,7 @@ public void ClearWaveConditionsCalculationOutputAndRemoveTargetProbability_CalculationsForTargetProbabilityNull_ThrowsArgumentNullException() { // Call - void Call() => WaveConditionsDataSynchronizationService.ClearWaveConditionsCalculationOutputAndRemoveTargetProbability>( + void Call() => WaveConditionsDataSynchronizationService.ClearWaveConditionsCalculationOutputAndRemoveTargetProbability>( new TestFailureMechanism(), null); // Assert @@ -260,7 +260,7 @@ }, true); var mocks = new MockRepository(); - var failureMechanism = mocks.Stub(); + var failureMechanism = mocks.Stub(); failureMechanism.Stub(fm => fm.Calculations).Return(new[] { calculation1, @@ -281,9 +281,9 @@ calculation4, calculation4.InputParameters }; - + // Call - IEnumerable affectedObjects = WaveConditionsDataSynchronizationService.ClearWaveConditionsCalculationOutputAndRemoveTargetProbability>( + IEnumerable affectedObjects = WaveConditionsDataSynchronizationService.ClearWaveConditionsCalculationOutputAndRemoveTargetProbability>( failureMechanism, calculationsForTargetProbabilityToClear); // Assert @@ -292,7 +292,7 @@ c => !c.HasOutput && c.InputParameters.WaterLevelType == WaveConditionsInputWaterLevelType.None)); Assert.IsTrue(expectedAffectedCalculations.All(c => c.InputParameters.CalculationsTargetProbability == null)); - + Assert.IsTrue(failureMechanism.Calculations.Except(expectedAffectedCalculations).All(c => c.HasOutput)); Assert.IsNotNull(calculation5.InputParameters.CalculationsTargetProbability); mocks.VerifyAll();