Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffInwardsFailureMechanismResultViewInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffInwardsFailureMechanismResultViewInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffInwardsFailureMechanismResultViewInfoTest.cs (revision 3f7958e07bed38f4dba407be2fd4715048f3c849)
@@ -0,0 +1,238 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.Controls.Views;
+using Core.Gui.Plugin;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Forms.PresentationObjects;
+using Riskeer.Common.Forms.Views;
+using Riskeer.Integration.Data.StandAlone;
+using Riskeer.Integration.Forms.PresentationObjects.StandAlone;
+
+namespace Riskeer.Integration.Plugin.Test.ViewInfos
+{
+ [TestFixture]
+ public class GrassCoverSlipOffInwardsFailureMechanismResultViewInfoTest
+ {
+ private MockRepository mocks;
+ private RiskeerPlugin plugin;
+ private ViewInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new RiskeerPlugin();
+ info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(NonAdoptableWithProfileProbabilityFailureMechanismResultView));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(GrassCoverSlipOffInwardsFailureMechanismSectionResultContext), info.DataType);
+ Assert.AreEqual(typeof(IObservableEnumerable), info.ViewDataType);
+ }
+
+ [Test]
+ public void GetViewData_WithContext_ReturnsWrappedFailureMechanismResult()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+ var context = new GrassCoverSlipOffInwardsFailureMechanismSectionResultContext(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection);
+
+ // Call
+ object viewData = info.GetViewData(context);
+
+ // Assert
+ Assert.AreSame(failureMechanism.SectionResults, viewData);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetViewName_Always_ReturnsViewName()
+ {
+ // Call
+ string viewName = info.GetViewName(null, null);
+
+ // Assert
+ Assert.AreEqual("Resultaat", viewName);
+ }
+
+ [Test]
+ public void CloseForData_AssessmentSectionRemovedWithoutFailureMechanism_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[0]);
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ var otherFailureMechanism = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new[]
+ {
+ otherFailureMechanism
+ });
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[]
+ {
+ failureMechanism
+ });
+ mocks.ReplayAll();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedFailureMechanismContext_ReturnsTrue()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+
+ var assessmentSection = mocks.Stub();
+ var failurePathContext = mocks.StrictMock>();
+ failurePathContext.Expect(fm => fm.WrappedData).Return(failureMechanism);
+ mocks.ReplayAll();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, failurePathContext);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ var failurePathContext = mocks.StrictMock>();
+ failurePathContext.Expect(fm => fm.WrappedData).Return(new GrassCoverSlipOffInwardsFailureMechanism());
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, failurePathContext);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CreateInstance_WithContext_ReturnsView()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+ var context = new GrassCoverSlipOffInwardsFailureMechanismSectionResultContext(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection);
+
+ // Call
+ IView view = info.CreateInstance(context);
+
+ // Assert
+ Assert.IsInstanceOf>(view);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 3f7958e07bed38f4dba407be2fd4715048f3c849 refers to a dead (removed) revision in file `Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffInwardsResultViewInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffOutwardsFailureMechanismResultViewInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffOutwardsFailureMechanismResultViewInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffOutwardsFailureMechanismResultViewInfoTest.cs (revision 3f7958e07bed38f4dba407be2fd4715048f3c849)
@@ -0,0 +1,238 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.Controls.Views;
+using Core.Gui.Plugin;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Forms.PresentationObjects;
+using Riskeer.Common.Forms.Views;
+using Riskeer.Integration.Data.StandAlone;
+using Riskeer.Integration.Forms.PresentationObjects.StandAlone;
+
+namespace Riskeer.Integration.Plugin.Test.ViewInfos
+{
+ [TestFixture]
+ public class GrassCoverSlipOffOutwardsFailureMechanismResultViewInfoTest
+ {
+ private MockRepository mocks;
+ private RiskeerPlugin plugin;
+ private ViewInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new RiskeerPlugin();
+ info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(NonAdoptableWithProfileProbabilityFailureMechanismResultView));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(GrassCoverSlipOffOutwardsFailureMechanismSectionResultContext), info.DataType);
+ Assert.AreEqual(typeof(IObservableEnumerable), info.ViewDataType);
+ }
+
+ [Test]
+ public void GetViewData_WithContext_ReturnsWrappedFailureMechanismResult()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+ var context = new GrassCoverSlipOffOutwardsFailureMechanismSectionResultContext(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection);
+
+ // Call
+ object viewData = info.GetViewData(context);
+
+ // Assert
+ Assert.AreSame(failureMechanism.SectionResults, viewData);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetViewName_Always_ReturnsViewName()
+ {
+ // Call
+ string viewName = info.GetViewName(null, null);
+
+ // Assert
+ Assert.AreEqual("Resultaat", viewName);
+ }
+
+ [Test]
+ public void CloseForData_AssessmentSectionRemovedWithoutFailureMechanism_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[0]);
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ var otherFailureMechanism = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new[]
+ {
+ otherFailureMechanism
+ });
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[]
+ {
+ failureMechanism
+ });
+ mocks.ReplayAll();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedFailureMechanismContext_ReturnsTrue()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+
+ var assessmentSection = mocks.Stub();
+ var failurePathContext = mocks.StrictMock>();
+ failurePathContext.Expect(fm => fm.WrappedData).Return(failureMechanism);
+ mocks.ReplayAll();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, failurePathContext);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ var failurePathContext = mocks.StrictMock>();
+ failurePathContext.Expect(fm => fm.WrappedData).Return(new GrassCoverSlipOffOutwardsFailureMechanism());
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, failurePathContext);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CreateInstance_WithContext_ReturnsView()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+ var context = new GrassCoverSlipOffOutwardsFailureMechanismSectionResultContext(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection);
+
+ // Call
+ IView view = info.CreateInstance(context);
+
+ // Assert
+ Assert.IsInstanceOf>(view);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 3f7958e07bed38f4dba407be2fd4715048f3c849 refers to a dead (removed) revision in file `Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffOutwardsResultViewInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/MacroStabilityOutwardsFailureMechanismResultViewInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/MacroStabilityOutwardsFailureMechanismResultViewInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/MacroStabilityOutwardsFailureMechanismResultViewInfoTest.cs (revision 3f7958e07bed38f4dba407be2fd4715048f3c849)
@@ -0,0 +1,238 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.Controls.Views;
+using Core.Gui.Plugin;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Forms.PresentationObjects;
+using Riskeer.Integration.Data.StandAlone;
+using Riskeer.Integration.Data.StandAlone.SectionResults;
+using Riskeer.Integration.Forms.Views.SectionResultViews;
+
+namespace Riskeer.Integration.Plugin.Test.ViewInfos
+{
+ [TestFixture]
+ public class MacroStabilityOutwardsFailureMechanismResultViewInfoTest
+ {
+ private MockRepository mocks;
+ private RiskeerPlugin plugin;
+ private ViewInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new RiskeerPlugin();
+ info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(MacroStabilityOutwardsResultViewOld));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(ProbabilityFailureMechanismSectionResultContext), info.DataType);
+ Assert.AreEqual(typeof(IObservableEnumerable), info.ViewDataType);
+ }
+
+ [Test]
+ public void GetViewData_WithContext_ReturnsWrappedFailureMechanismResult()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ var context = new ProbabilityFailureMechanismSectionResultContext(failureMechanism.SectionResultsOld,
+ failureMechanism,
+ assessmentSection);
+
+ // Call
+ object viewData = info.GetViewData(context);
+
+ // Assert
+ Assert.AreSame(failureMechanism.SectionResultsOld, viewData);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetViewName_Always_ReturnsViewName()
+ {
+ // Call
+ string viewName = info.GetViewName(null, null);
+
+ // Assert
+ Assert.AreEqual("Resultaat", viewName);
+ }
+
+ [Test]
+ public void CloseForData_AssessmentSectionRemovedWithoutFailureMechanism_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[0]);
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+
+ using (var view = new MacroStabilityOutwardsResultViewOld(failureMechanism.SectionResultsOld, failureMechanism, assessmentSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse()
+ {
+ // Setup
+ var otherAssessmentSection = mocks.Stub();
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ var otherFailureMechanism = mocks.Stub();
+
+ otherAssessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new[]
+ {
+ otherFailureMechanism
+ });
+
+ mocks.ReplayAll();
+
+ using (var view = new MacroStabilityOutwardsResultViewOld(failureMechanism.SectionResultsOld, failureMechanism, otherAssessmentSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, otherAssessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[]
+ {
+ failureMechanism
+ });
+
+ mocks.ReplayAll();
+
+ using (var view = new MacroStabilityOutwardsResultViewOld(failureMechanism.SectionResultsOld, failureMechanism, assessmentSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedFailureMechanismContext_ReturnsTrue()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ var failurePathContext = mocks.StrictMock>();
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ failurePathContext.Expect(fm => fm.WrappedData).Return(failureMechanism);
+
+ mocks.ReplayAll();
+
+ using (var view = new MacroStabilityOutwardsResultViewOld(failureMechanism.SectionResultsOld, failureMechanism, assessmentSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, failurePathContext);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ var failureMechanismContext = mocks.StrictMock>();
+ failureMechanismContext.Expect(fm => fm.WrappedData).Return(new MacroStabilityOutwardsFailureMechanism());
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+
+ using (var view = new MacroStabilityOutwardsResultViewOld(failureMechanism.SectionResultsOld, failureMechanism, assessmentSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, failureMechanismContext);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CreateInstance_WithContext_ReturnsView()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ var context = new ProbabilityFailureMechanismSectionResultContext(
+ failureMechanism.SectionResultsOld,
+ failureMechanism,
+ assessmentSection);
+
+ // Call
+ IView view = info.CreateInstance(context);
+
+ // Assert
+ Assert.IsInstanceOf(view);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 3f7958e07bed38f4dba407be2fd4715048f3c849 refers to a dead (removed) revision in file `Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/MacroStabilityOutwardsResultViewInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/MicrostabilityFailureMechanismResultViewInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/MicrostabilityFailureMechanismResultViewInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/MicrostabilityFailureMechanismResultViewInfoTest.cs (revision 3f7958e07bed38f4dba407be2fd4715048f3c849)
@@ -0,0 +1,237 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.Controls.Views;
+using Core.Gui.Plugin;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Forms.PresentationObjects;
+using Riskeer.Common.Forms.Views;
+using Riskeer.Integration.Data.StandAlone;
+using Riskeer.Integration.Forms.PresentationObjects.StandAlone;
+
+namespace Riskeer.Integration.Plugin.Test.ViewInfos
+{
+ [TestFixture]
+ public class MicrostabilityFailureMechanismResultViewInfoTest
+ {
+ private MockRepository mocks;
+ private RiskeerPlugin plugin;
+ private ViewInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new RiskeerPlugin();
+ info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(NonAdoptableWithProfileProbabilityFailureMechanismResultView));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(MicrostabilityFailureMechanismSectionResultContext), info.DataType);
+ Assert.AreEqual(typeof(IObservableEnumerable), info.ViewDataType);
+ }
+
+ [Test]
+ public void GetViewData_WithContext_ReturnsWrappedFailureMechanismResult()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new MicrostabilityFailureMechanism();
+ var context = new MicrostabilityFailureMechanismSectionResultContext(failureMechanism.SectionResults, failureMechanism, assessmentSection);
+
+ // Call
+ object viewData = info.GetViewData(context);
+
+ // Assert
+ Assert.AreSame(failureMechanism.SectionResults, viewData);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetViewName_Always_ReturnsViewName()
+ {
+ // Call
+ string viewName = info.GetViewName(null, null);
+
+ // Assert
+ Assert.AreEqual("Resultaat", viewName);
+ }
+
+ [Test]
+ public void CloseForData_AssessmentSectionRemovedWithoutFailureMechanism_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[0]);
+ mocks.ReplayAll();
+
+ var failureMechanism = new MicrostabilityFailureMechanism();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse()
+ {
+ // Setup
+ var otherFailureMechanism = mocks.Stub();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new[]
+ {
+ otherFailureMechanism
+ });
+ mocks.ReplayAll();
+
+ var failureMechanism = new MicrostabilityFailureMechanism();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue()
+ {
+ // Setup
+ var failureMechanism = new MicrostabilityFailureMechanism();
+
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[]
+ {
+ failureMechanism
+ });
+ mocks.ReplayAll();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedFailureMechanismContext_ReturnsTrue()
+ {
+ // Setup
+ var failureMechanism = new MicrostabilityFailureMechanism();
+
+ var assessmentSection = mocks.Stub();
+ var failurePathContext = mocks.StrictMock>();
+ failurePathContext.Expect(fm => fm.WrappedData).Return(failureMechanism);
+ mocks.ReplayAll();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, failurePathContext);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ var failurePathContext = mocks.StrictMock>();
+ failurePathContext.Expect(fm => fm.WrappedData).Return(new MicrostabilityFailureMechanism());
+ mocks.ReplayAll();
+
+ var failureMechanism = new MicrostabilityFailureMechanism();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, failurePathContext);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CreateInstance_WithContext_ReturnsView()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new MicrostabilityFailureMechanism();
+ var context = new MicrostabilityFailureMechanismSectionResultContext(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection);
+
+ // Call
+ IView view = info.CreateInstance(context);
+
+ // Assert
+ Assert.IsInstanceOf>(view);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 3f7958e07bed38f4dba407be2fd4715048f3c849 refers to a dead (removed) revision in file `Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/MicrostabilityResultViewInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/PipingStructureFailureMechanismResultViewInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/PipingStructureFailureMechanismResultViewInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/PipingStructureFailureMechanismResultViewInfoTest.cs (revision 3f7958e07bed38f4dba407be2fd4715048f3c849)
@@ -0,0 +1,236 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.Controls.Views;
+using Core.Gui.Plugin;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Forms.PresentationObjects;
+using Riskeer.Common.Forms.Views;
+using Riskeer.Integration.Data.StandAlone;
+using Riskeer.Integration.Forms.PresentationObjects.StandAlone;
+
+namespace Riskeer.Integration.Plugin.Test.ViewInfos
+{
+ [TestFixture]
+ public class PipingStructureFailureMechanismResultViewInfoTest
+ {
+ private MockRepository mocks;
+ private RiskeerPlugin plugin;
+ private ViewInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new RiskeerPlugin();
+ info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(NonAdoptableFailureMechanismResultView));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(PipingStructureFailureMechanismSectionResultContext), info.DataType);
+ Assert.AreEqual(typeof(IObservableEnumerable), info.ViewDataType);
+ }
+
+ [Test]
+ public void GetViewData_WithContext_ReturnsWrappedFailureMechanismResult()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingStructureFailureMechanism();
+ var context = new PipingStructureFailureMechanismSectionResultContext(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection);
+
+ // Call
+ object viewData = info.GetViewData(context);
+
+ // Assert
+ Assert.AreSame(failureMechanism.SectionResults, viewData);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetViewName_Always_ReturnsViewName()
+ {
+ // Call
+ string viewName = info.GetViewName(null, null);
+
+ // Assert
+ Assert.AreEqual("Resultaat", viewName);
+ }
+
+ [Test]
+ public void CloseForData_AssessmentSectionRemovedWithoutFailureMechanism_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[0]);
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingStructureFailureMechanism();
+ using (var view = new NonAdoptableFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse()
+ {
+ // Setup
+ var otherFailureMechanism = mocks.Stub();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new[]
+ {
+ otherFailureMechanism
+ });
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingStructureFailureMechanism();
+ using (var view = new NonAdoptableFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue()
+ {
+ // Setup
+ var failureMechanism = new PipingStructureFailureMechanism();
+
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[]
+ {
+ failureMechanism
+ });
+ mocks.ReplayAll();
+
+ using (var view = new NonAdoptableFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedFailureMechanismContext_ReturnsTrue()
+ {
+ // Setup
+ var failureMechanism = new PipingStructureFailureMechanism();
+
+ var failurePathContext = mocks.StrictMock>();
+ failurePathContext.Expect(fm => fm.WrappedData).Return(failureMechanism);
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ using (var view = new NonAdoptableFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, failurePathContext);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse()
+ {
+ // Setup
+ var failurePathContext = mocks.StrictMock>();
+ failurePathContext.Expect(fm => fm.WrappedData).Return(new PipingStructureFailureMechanism());
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingStructureFailureMechanism();
+
+ using (var view = new NonAdoptableFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, failurePathContext);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CreateInstance_WithContext_ReturnsView()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingStructureFailureMechanism();
+ var context = new PipingStructureFailureMechanismSectionResultContext(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection);
+
+ // Call
+ IView view = info.CreateInstance(context);
+
+ // Assert
+ Assert.IsInstanceOf>(view);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 3f7958e07bed38f4dba407be2fd4715048f3c849 refers to a dead (removed) revision in file `Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/PipingStructureResultViewInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/WaterPressureAsphaltCoverFailureMechanismResultViewInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/WaterPressureAsphaltCoverFailureMechanismResultViewInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/WaterPressureAsphaltCoverFailureMechanismResultViewInfoTest.cs (revision 3f7958e07bed38f4dba407be2fd4715048f3c849)
@@ -0,0 +1,241 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.Controls.Views;
+using Core.Gui.Plugin;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Forms.PresentationObjects;
+using Riskeer.Common.Forms.Views;
+using Riskeer.Integration.Data.StandAlone;
+using Riskeer.Integration.Forms.PresentationObjects.StandAlone;
+
+namespace Riskeer.Integration.Plugin.Test.ViewInfos
+{
+ [TestFixture]
+ public class WaterPressureAsphaltCoverFailureMechanismResultViewInfoTest
+ {
+ private MockRepository mocks;
+ private RiskeerPlugin plugin;
+ private ViewInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new RiskeerPlugin();
+ info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(NonAdoptableWithProfileProbabilityFailureMechanismResultView));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(WaterPressureAsphaltCoverFailureMechanismSectionResultContext), info.DataType);
+ Assert.AreEqual(typeof(IObservableEnumerable), info.ViewDataType);
+ }
+
+ [Test]
+ public void GetViewData_WithContext_ReturnsWrappedFailureMechanismResult()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+ var context = new WaterPressureAsphaltCoverFailureMechanismSectionResultContext(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection);
+
+ // Call
+ object viewData = info.GetViewData(context);
+
+ // Assert
+ Assert.AreSame(failureMechanism.SectionResults, viewData);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetViewName_Always_ReturnsViewName()
+ {
+ // Call
+ string viewName = info.GetViewName(null, null);
+
+ // Assert
+ Assert.AreEqual("Resultaat", viewName);
+ }
+
+ [Test]
+ public void CloseForData_AssessmentSectionRemovedWithoutFailureMechanism_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[0]);
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+ var otherFailureMechanism = mocks.Stub();
+
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new[]
+ {
+ otherFailureMechanism
+ });
+
+ mocks.ReplayAll();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[]
+ {
+ failureMechanism
+ });
+
+ mocks.ReplayAll();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedFailureMechanismContext_ReturnsTrue()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+
+ var failurePathContext = mocks.StrictMock>();
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+ failurePathContext.Expect(fm => fm.WrappedData).Return(failureMechanism);
+ mocks.ReplayAll();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, failurePathContext);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+
+ var failurePathContext = mocks.StrictMock>();
+ failurePathContext.Expect(fm => fm.WrappedData).Return(new WaterPressureAsphaltCoverFailureMechanism());
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+
+ using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection, fm => fm.GeneralInput.N, fm => fm.GeneralInput.ApplyLengthEffectInSection))
+ {
+ // Call
+ bool closeForData = info.CloseForData(view, failurePathContext);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CreateInstance_WithContext_ReturnsView()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+ var context = new WaterPressureAsphaltCoverFailureMechanismSectionResultContext(
+ failureMechanism.SectionResults, failureMechanism, assessmentSection);
+ mocks.ReplayAll();
+
+ // Call
+ IView view = info.CreateInstance(context);
+
+ // Assert
+ Assert.IsInstanceOf>(view);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 3f7958e07bed38f4dba407be2fd4715048f3c849 refers to a dead (removed) revision in file `Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/WaterPressureAsphaltCoverResultViewInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?