Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/InputContextBaseTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/InputContextBaseTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/InputContextBaseTest.cs (revision 34a4f74321211475c627f5a78ed98359df5ee150) @@ -0,0 +1,86 @@ +// 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 NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.PresentationObjects; + +namespace Ringtoets.Common.Forms.Test.PresentationObjects +{ + [TestFixture] + public class InputContextBaseTest + { + [Test] + public void ParameteredConstructor_ExpectedValues() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSectionStub = mockRepository.Stub(); + var inputStub = mockRepository.Stub(); + var calculationStub = mockRepository.Stub(); + var failureMechanismStub = mockRepository.Stub(); + mockRepository.ReplayAll(); + + // Call + var context = new SimpleInputContext(inputStub, calculationStub, failureMechanismStub, assessmentSectionStub); + + // Assert + Assert.IsInstanceOf>(context); + Assert.AreSame(inputStub, context.WrappedData); + Assert.AreSame(calculationStub, context.Calculation); + Assert.AreSame(failureMechanismStub, context.FailureMechanism); + Assert.AreSame(assessmentSectionStub, context.AssessmentSection); + mockRepository.VerifyAll(); + } + + [Test] + public void ParameteredConstructor_CalculationIsNull_ThrowsArgumentNullException() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSectionStub = mockRepository.Stub(); + var inputStub = mockRepository.Stub(); + var failureMechanismStub = mockRepository.Stub(); + mockRepository.ReplayAll(); + + // Call + TestDelegate call = () => new SimpleInputContext(inputStub, null, failureMechanismStub, assessmentSectionStub); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("calculation", exception.ParamName); + mockRepository.VerifyAll(); + } + + private class SimpleInputContext : InputContextBase + where TInput : ICalculationInput + where TCalculation : ICalculation + where TFailureMechanism : IFailureMechanism + { + public SimpleInputContext(TInput input, TCalculation calculation, TFailureMechanism failureMechanism, IAssessmentSection assessmentSection) + : base(input, calculation, failureMechanism, assessmentSection) { } + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -rca23b1b155ca87c0aa4665fd919727570f31c781 -r34a4f74321211475c627f5a78ed98359df5ee150 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision ca23b1b155ca87c0aa4665fd919727570f31c781) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 34a4f74321211475c627f5a78ed98359df5ee150) @@ -67,6 +67,7 @@ +