Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/AssessmentSection/AssessmentSectionCompositionTest.cs =================================================================== diff -u -r36b8bccd17cbe9159fae9c6b6edb93d04415b772 -r6a0d36b218ea1ebfa308960b3321bf4b7b099fac --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/AssessmentSection/AssessmentSectionCompositionTest.cs (.../AssessmentSectionCompositionTest.cs) (revision 36b8bccd17cbe9159fae9c6b6edb93d04415b772) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/AssessmentSection/AssessmentSectionCompositionTest.cs (.../AssessmentSectionCompositionTest.cs) (revision 6a0d36b218ea1ebfa308960b3321bf4b7b099fac) @@ -28,25 +28,21 @@ [TestFixture] public class AssessmentSectionCompositionTest { - [TestFixture] - public class WaveConditionsInputStepSizeTest + [Test] + public void DisplayName_Always_ReturnExpectedValues() { - [Test] - public void DisplayName_Always_ReturnExpectedValues() - { - // Assert - Assert.AreEqual("Dijk", GetDisplayName(AssessmentSectionComposition.Dike)); - Assert.AreEqual("Duin", GetDisplayName(AssessmentSectionComposition.Dune)); - Assert.AreEqual("Dijk / Duin", GetDisplayName(AssessmentSectionComposition.DikeAndDune)); - } + // Assert + Assert.AreEqual("Dijk", GetDisplayName(AssessmentSectionComposition.Dike)); + Assert.AreEqual("Duin", GetDisplayName(AssessmentSectionComposition.Dune)); + Assert.AreEqual("Dijk / Duin", GetDisplayName(AssessmentSectionComposition.DikeAndDune)); + } - private string GetDisplayName(AssessmentSectionComposition value) - { - var type = typeof(AssessmentSectionComposition); - var memInfo = type.GetMember(value.ToString()); - var attributes = memInfo[0].GetCustomAttributes(typeof(ResourcesDisplayNameAttribute), false); - return ((ResourcesDisplayNameAttribute)attributes[0]).DisplayName; - } + private string GetDisplayName(AssessmentSectionComposition value) + { + var type = typeof(AssessmentSectionComposition); + var memInfo = type.GetMember(value.ToString()); + var attributes = memInfo[0].GetCustomAttributes(typeof(ResourcesDisplayNameAttribute), false); + return ((ResourcesDisplayNameAttribute) attributes[0]).DisplayName; } } -} +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/FailureMechanismContributionProperties.cs =================================================================== diff -u -r36b8bccd17cbe9159fae9c6b6edb93d04415b772 -r6a0d36b218ea1ebfa308960b3321bf4b7b099fac --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/FailureMechanismContributionProperties.cs (.../FailureMechanismContributionProperties.cs) (revision 36b8bccd17cbe9159fae9c6b6edb93d04415b772) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/FailureMechanismContributionProperties.cs (.../FailureMechanismContributionProperties.cs) (revision 6a0d36b218ea1ebfa308960b3321bf4b7b099fac) @@ -106,7 +106,7 @@ /// /// Gets or sets the for when the norm changes. /// - /// Thrown when nullis set. + /// Thrown when null is set. [DynamicVisible] public IFailureMechanismContributionNormChangeHandler NormChangeHandler { @@ -127,7 +127,7 @@ /// /// Gets or sets the for when the norm changes. /// - /// Thrown when nullis set. + /// Thrown when null is set. [DynamicVisible] public IAssessmentSectionCompositionChangeHandler CompositionChangeHandler { Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/FailureMechanismContributionPropertiesTest.cs =================================================================== diff -u -r3d6119b921ede5e5eea3de083a17a26f12ffa447 -r6a0d36b218ea1ebfa308960b3321bf4b7b099fac --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/FailureMechanismContributionPropertiesTest.cs (.../FailureMechanismContributionPropertiesTest.cs) (revision 3d6119b921ede5e5eea3de083a17a26f12ffa447) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/FailureMechanismContributionPropertiesTest.cs (.../FailureMechanismContributionPropertiesTest.cs) (revision 6a0d36b218ea1ebfa308960b3321bf4b7b099fac) @@ -143,7 +143,7 @@ } [Test] - public void GivenReturnPeriod_WhenConfirmingReturnPeriodValueChange_ReturnPeriodSetAndNotifiesObserver() + public void GivenReturnPeriod_WhenConfirmingReturnPeriodValueChange_ThenReturnPeriodSetAndNotifiesObserver() { // Given AssessmentSection assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -187,7 +187,7 @@ } [Test] - public void GivenReturnPeriod_WhenCancellingReturnPeriodValueChange_NothingHappens() + public void GivenReturnPeriod_WhenCancellingReturnPeriodValueChange_ThenDataSameObserversNotNotified() { // Given AssessmentSection assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -229,7 +229,7 @@ } [Test] - public void GivenAssessmentSectionComposition_WhenConfirmingCompositionValueChange_AssessmentSectionCompositionSetAndNotifiesObserver() + public void GivenAssessmentSectionComposition_WhenConfirmingCompositionValueChange_ThenAssessmentSectionCompositionSetAndNotifiesObserver() { // Given const AssessmentSectionComposition originalComposition = AssessmentSectionComposition.Dike; @@ -271,7 +271,7 @@ } [Test] - public void GivenAssessmentSectionComposition_WhenCancellingCompositionValueChange_NothingHappens() + public void GivenAssessmentSectionComposition_WhenCancellingCompositionValueChange__ThenDataSameObserversNotNotified() { // Given const AssessmentSectionComposition originalComposition = AssessmentSectionComposition.Dike; Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/FailureMechanismContributionPropertyInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/FailureMechanismContributionPropertyInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/FailureMechanismContributionPropertyInfoTest.cs (revision 6a0d36b218ea1ebfa308960b3321bf4b7b099fac) @@ -0,0 +1,129 @@ +// 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.Linq; +using Core.Common.Gui.Plugin; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Contribution; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.PropertyClasses; + +namespace Ringtoets.Integration.Plugin.Test.PropertyInfos +{ + [TestFixture] + public class FailureMechanismContributionPropertyInfoTest + { + private RingtoetsPlugin plugin; + private PropertyInfo info; + + [SetUp] + public void SetUp() + { + plugin = new RingtoetsPlugin(); + info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(FailureMechanismContributionProperties)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.IsNull(info.AdditionalDataCheck); + Assert.IsNotNull(info.GetObjectPropertiesData); + Assert.IsNotNull(info.AfterCreate); + Assert.AreEqual(typeof(FailureMechanismContributionContext), info.DataType); + Assert.AreEqual(typeof(FailureMechanismContributionProperties), info.PropertyObjectType); + } + + [Test] + public void GetObjectPropertiesData_Always_ReturnsFailureMechanismContribution() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.StrictMock(); + mocks.ReplayAll(); + + var failureMechanisms = Enumerable.Empty(); + var failureMechanismContribution = new FailureMechanismContribution(failureMechanisms, 1.1, 1.0/200); + var context = new FailureMechanismContributionContext(failureMechanismContribution, assessmentSection); + + // Call + var objectPropertiesData = info.GetObjectPropertiesData(context); + + // Assert + Assert.AreSame(failureMechanismContribution, objectPropertiesData); + + mocks.VerifyAll(); + } + + [Test] + public void AfterCreate_Always_SetsAssessmentSection() + { + // Setup + var mocks = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStubWithoutBoundaryDatabaseOrFailureMechanisms(mocks); + mocks.ReplayAll(); + + var propertyInfo = new FailureMechanismContributionProperties(); + var context = new FailureMechanismContributionContext(assessmentSectionStub.FailureMechanismContribution, assessmentSectionStub); + + // Call + info.AfterCreate(propertyInfo, context); + + // Assert + Assert.AreSame(assessmentSectionStub, propertyInfo.AssessmentSection); + + mocks.VerifyAll(); + } + + [Test] + public void AfterCreate_Always_SetsChangeHandlers() + { + // Setup + var mocks = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStubWithoutBoundaryDatabaseOrFailureMechanisms(mocks); + mocks.ReplayAll(); + + var propertyInfo = new FailureMechanismContributionProperties(); + var context = new FailureMechanismContributionContext(assessmentSectionStub.FailureMechanismContribution, assessmentSectionStub); + + info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(FailureMechanismContributionProperties)); + + // Call + info.AfterCreate(propertyInfo, context); + + // Assert + Assert.IsNotNull(propertyInfo.NormChangeHandler); + Assert.IsNotNull(propertyInfo.CompositionChangeHandler); + + mocks.VerifyAll(); + } + } +} \ No newline at end of file Fisheye: Tag 6a0d36b218ea1ebfa308960b3321bf4b7b099fac refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/FailureMechanismPropertyInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -r36b8bccd17cbe9159fae9c6b6edb93d04415b772 -r6a0d36b218ea1ebfa308960b3321bf4b7b099fac --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 36b8bccd17cbe9159fae9c6b6edb93d04415b772) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 6a0d36b218ea1ebfa308960b3321bf4b7b099fac) @@ -75,7 +75,7 @@ - +