Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r0f065fd28bb73332728fbfccebe7ce647cd008b6 -r24a4dedceab58b48ea5ca0a463a0a7b614e26590 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 0f065fd28bb73332728fbfccebe7ce647cd008b6) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 24a4dedceab58b48ea5ca0a463a0a7b614e26590) @@ -174,6 +174,9 @@ + + UserControl + UserControl Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CloseForFailureMechanismView.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CloseForFailureMechanismView.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CloseForFailureMechanismView.cs (revision 24a4dedceab58b48ea5ca0a463a0a7b614e26590) @@ -0,0 +1,57 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Windows.Forms; +using Core.Common.Controls.Views; +using Ringtoets.Common.Data.FailureMechanism; + +namespace Ringtoets.Common.Forms.Views +{ + /// + /// Class defining a base view for assembly category views. + /// + public abstract class CloseForFailureMechanismView : UserControl, IView + { + /// + /// Creates a new instance of . + /// + /// The failure mechanism belonging to the view. + /// Thrown when + /// is null. + protected CloseForFailureMechanismView(IFailureMechanism failureMechanism) + { + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + FailureMechanism = failureMechanism; + } + + /// + /// Gets the the view belongs to. + /// + public IFailureMechanism FailureMechanism { get; } + + public object Data { get; set; } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r0f065fd28bb73332728fbfccebe7ce647cd008b6 -r24a4dedceab58b48ea5ca0a463a0a7b614e26590 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 0f065fd28bb73332728fbfccebe7ce647cd008b6) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 24a4dedceab58b48ea5ca0a463a0a7b614e26590) @@ -161,6 +161,7 @@ + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/CloseForFailureMechanismViewTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/CloseForFailureMechanismViewTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/CloseForFailureMechanismViewTest.cs (revision 24a4dedceab58b48ea5ca0a463a0a7b614e26590) @@ -0,0 +1,68 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Windows.Forms; +using Core.Common.Controls.Views; +using NUnit.Framework; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.Views; + +namespace Ringtoets.Common.Forms.Test.Views +{ + [TestFixture] + public class CloseForFailureMechanismViewTest + { + [Test] + public void Constructor_FailureMechanismNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new TestCloseForFailureMechanismView(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanism", exception.ParamName); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var failureMechanism = new TestFailureMechanism(); + + // Call + var view = new TestCloseForFailureMechanismView(failureMechanism); + + // Assert + Assert.IsInstanceOf(view); + Assert.IsInstanceOf(view); + Assert.IsNull(view.Data); + Assert.AreSame(failureMechanism, view.FailureMechanism); + Assert.AreEqual(0, view.Controls.Count); + } + + private class TestCloseForFailureMechanismView : CloseForFailureMechanismView + { + public TestCloseForFailureMechanismView(IFailureMechanism failureMechanism) : base(failureMechanism) {} + } + } +} \ No newline at end of file