Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneErosionFailureMechanismHelper.cs =================================================================== diff -u --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneErosionFailureMechanismHelper.cs (revision 0) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneErosionFailureMechanismHelper.cs (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -0,0 +1,49 @@ +// 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.Linq; + +namespace Ringtoets.DuneErosion.Data +{ + /// + /// Class containing helper methods for . + /// + public static class DuneErosionFailureMechanismHelper + { + /// + /// Determines if the failure mechanism has section assembly results that are manually overwritten. + /// + /// The . + /// true if the failure mechanism contains section assembly results that are manually overwritten, + /// false otherwise. + /// Thrown when is null. + public static bool HasManualAssemblyResults(DuneErosionFailureMechanism failureMechanism) + { + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + return failureMechanism.SectionResults.Any(sr => sr.UseManualAssemblyCategoryGroup); + } + } +} \ No newline at end of file Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/Ringtoets.DuneErosion.Data.csproj =================================================================== diff -u -r649b0974fb71df7368d19682bc255618f44d49c1 -r13ba5757d5c7920c6070203275bf86adae620562 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/Ringtoets.DuneErosion.Data.csproj (.../Ringtoets.DuneErosion.Data.csproj) (revision 649b0974fb71df7368d19682bc255618f44d49c1) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/Ringtoets.DuneErosion.Data.csproj (.../Ringtoets.DuneErosion.Data.csproj) (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -14,6 +14,7 @@ + Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneErosionFailureMechanismHelperTest.cs =================================================================== diff -u --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneErosionFailureMechanismHelperTest.cs (revision 0) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneErosionFailureMechanismHelperTest.cs (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -0,0 +1,93 @@ +// 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.Linq; +using Core.Common.Base.Geometry; +using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; + +namespace Ringtoets.DuneErosion.Data.Test +{ + [TestFixture] + public class DuneErosionFailureMechanismHelperTest + { + [Test] + public void HasManualAssemblyResults_FailureMechanismNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => DuneErosionFailureMechanismHelper.HasManualAssemblyResults(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanism", exception.ParamName); + } + + [Test] + public void HasManualAssemblyResults_FailureMechanismWithManualAssemblyResults_ReturnsTrue() + { + // Setup + var failureMechanism = new DuneErosionFailureMechanism(); + FailureMechanismTestHelper.SetSections(failureMechanism, new[] + { + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }), + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }) + }); + failureMechanism.SectionResults.First().UseManualAssemblyCategoryGroup = true; + + // Call + bool hasManualAssemblyResults = DuneErosionFailureMechanismHelper.HasManualAssemblyResults(failureMechanism); + + // Assert + Assert.IsTrue(hasManualAssemblyResults); + } + + [Test] + public void HasManualAssemblyResults_FailureMechanismWithoutManualAssemblyResults_ReturnsFalse() + { + // Setup + var failureMechanism = new DuneErosionFailureMechanism(); + FailureMechanismTestHelper.SetSections(failureMechanism, new[] + { + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }), + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }) + }); + + // Call + bool hasManualAssemblyResults = DuneErosionFailureMechanismHelper.HasManualAssemblyResults(failureMechanism); + + // Assert + Assert.IsFalse(hasManualAssemblyResults); + } + } +} \ No newline at end of file Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/Ringtoets.DuneErosion.Data.Test.csproj =================================================================== diff -u -r649b0974fb71df7368d19682bc255618f44d49c1 -r13ba5757d5c7920c6070203275bf86adae620562 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/Ringtoets.DuneErosion.Data.Test.csproj (.../Ringtoets.DuneErosion.Data.Test.csproj) (revision 649b0974fb71df7368d19682bc255618f44d49c1) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/Ringtoets.DuneErosion.Data.Test.csproj (.../Ringtoets.DuneErosion.Data.Test.csproj) (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -20,6 +20,7 @@ + Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GrassCoverErosionOutwardsFailureMechanismHelper.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GrassCoverErosionOutwardsFailureMechanismHelper.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GrassCoverErosionOutwardsFailureMechanismHelper.cs (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -0,0 +1,49 @@ +// 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.Linq; + +namespace Ringtoets.GrassCoverErosionOutwards.Data +{ + /// + /// Class containing helper methods for . + /// + public static class GrassCoverErosionOutwardsFailureMechanismHelper + { + /// + /// Determines if the failure mechanism has section assembly results that are manually overwritten. + /// + /// The . + /// true if the failure mechanism contains section assembly results that are manually overwritten, + /// false otherwise. + /// Thrown when is null. + public static bool HasManualAssemblyResults(GrassCoverErosionOutwardsFailureMechanism failureMechanism) + { + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + return failureMechanism.SectionResults.Any(sr => sr.UseManualAssemblyCategoryGroup); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/Ringtoets.GrassCoverErosionOutwards.Data.csproj =================================================================== diff -u -r433fc2ade8570da2d39f3e93ea7ae895cd88fa74 -r13ba5757d5c7920c6070203275bf86adae620562 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/Ringtoets.GrassCoverErosionOutwards.Data.csproj (.../Ringtoets.GrassCoverErosionOutwards.Data.csproj) (revision 433fc2ade8570da2d39f3e93ea7ae895cd88fa74) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/Ringtoets.GrassCoverErosionOutwards.Data.csproj (.../Ringtoets.GrassCoverErosionOutwards.Data.csproj) (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -15,6 +15,7 @@ + Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsFailureMechanismHelperTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsFailureMechanismHelperTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsFailureMechanismHelperTest.cs (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -0,0 +1,93 @@ +// 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.Linq; +using Core.Common.Base.Geometry; +using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; + +namespace Ringtoets.GrassCoverErosionOutwards.Data.Test +{ + [TestFixture] + public class GrassCoverErosionOutwardsFailureMechanismHelperTest + { + [Test] + public void HasManualAssemblyResults_FailureMechanismNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => GrassCoverErosionOutwardsFailureMechanismHelper.HasManualAssemblyResults(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanism", exception.ParamName); + } + + [Test] + public void HasManualAssemblyResults_FailureMechanismWithManualAssemblyResults_ReturnsTrue() + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + FailureMechanismTestHelper.SetSections(failureMechanism, new[] + { + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }), + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }) + }); + failureMechanism.SectionResults.First().UseManualAssemblyCategoryGroup = true; + + // Call + bool hasManualAssemblyResults = GrassCoverErosionOutwardsFailureMechanismHelper.HasManualAssemblyResults(failureMechanism); + + // Assert + Assert.IsTrue(hasManualAssemblyResults); + } + + [Test] + public void HasManualAssemblyResults_FailureMechanismWithoutManualAssemblyResults_ReturnsFalse() + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + FailureMechanismTestHelper.SetSections(failureMechanism, new[] + { + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }), + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }) + }); + + // Call + bool hasManualAssemblyResults = GrassCoverErosionOutwardsFailureMechanismHelper.HasManualAssemblyResults(failureMechanism); + + // Assert + Assert.IsFalse(hasManualAssemblyResults); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/Ringtoets.GrassCoverErosionOutwards.Data.Test.csproj =================================================================== diff -u -r7be3118c6dd22f2420d4b9f8eb4fa1c492cf44ea -r13ba5757d5c7920c6070203275bf86adae620562 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/Ringtoets.GrassCoverErosionOutwards.Data.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Data.Test.csproj) (revision 7be3118c6dd22f2420d4b9f8eb4fa1c492cf44ea) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/Ringtoets.GrassCoverErosionOutwards.Data.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Data.Test.csproj) (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -22,6 +22,7 @@ + Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Data/Ringtoets.StabilityStoneCover.Data.csproj =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -r13ba5757d5c7920c6070203275bf86adae620562 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Data/Ringtoets.StabilityStoneCover.Data.csproj (.../Ringtoets.StabilityStoneCover.Data.csproj) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Data/Ringtoets.StabilityStoneCover.Data.csproj (.../Ringtoets.StabilityStoneCover.Data.csproj) (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -19,6 +19,7 @@ Resources.resx + Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Data/StabilityStoneCoverFailureMechanismHelper.cs =================================================================== diff -u --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Data/StabilityStoneCoverFailureMechanismHelper.cs (revision 0) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Data/StabilityStoneCoverFailureMechanismHelper.cs (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -0,0 +1,49 @@ +// 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.Linq; + +namespace Ringtoets.StabilityStoneCover.Data +{ + /// + /// Class containing helper methods for . + /// + public static class StabilityStoneCoverFailureMechanismHelper + { + /// + /// Determines if the failure mechanism has section assembly results that are manually overwritten. + /// + /// The . + /// true if the failure mechanism contains section assembly results that are manually overwritten, + /// false otherwise. + /// Thrown when is null. + public static bool HasManualAssemblyResults(StabilityStoneCoverFailureMechanism failureMechanism) + { + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + return failureMechanism.SectionResults.Any(sr => sr.UseManualAssemblyCategoryGroup); + } + } +} \ No newline at end of file Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Data.Test/Ringtoets.StabilityStoneCover.Data.Test.csproj =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -r13ba5757d5c7920c6070203275bf86adae620562 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Data.Test/Ringtoets.StabilityStoneCover.Data.Test.csproj (.../Ringtoets.StabilityStoneCover.Data.Test.csproj) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Data.Test/Ringtoets.StabilityStoneCover.Data.Test.csproj (.../Ringtoets.StabilityStoneCover.Data.Test.csproj) (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -26,6 +26,7 @@ + Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Data.Test/StabilityStoneCoverFailureMechanismHelperTest.cs =================================================================== diff -u --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Data.Test/StabilityStoneCoverFailureMechanismHelperTest.cs (revision 0) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Data.Test/StabilityStoneCoverFailureMechanismHelperTest.cs (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -0,0 +1,93 @@ +// 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.Linq; +using Core.Common.Base.Geometry; +using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; + +namespace Ringtoets.StabilityStoneCover.Data.Test +{ + [TestFixture] + public class StabilityStoneCoverFailureMechanismHelperTest + { + [Test] + public void HasManualAssemblyResults_FailureMechanismNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => StabilityStoneCoverFailureMechanismHelper.HasManualAssemblyResults(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanism", exception.ParamName); + } + + [Test] + public void HasManualAssemblyResults_FailureMechanismWithManualAssemblyResults_ReturnsTrue() + { + // Setup + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + FailureMechanismTestHelper.SetSections(failureMechanism, new[] + { + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }), + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }) + }); + failureMechanism.SectionResults.First().UseManualAssemblyCategoryGroup = true; + + // Call + bool hasManualAssemblyResults = StabilityStoneCoverFailureMechanismHelper.HasManualAssemblyResults(failureMechanism); + + // Assert + Assert.IsTrue(hasManualAssemblyResults); + } + + [Test] + public void HasManualAssemblyResults_FailureMechanismWithoutManualAssemblyResults_ReturnsFalse() + { + // Setup + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + FailureMechanismTestHelper.SetSections(failureMechanism, new[] + { + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }), + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }) + }); + + // Call + bool hasManualAssemblyResults = StabilityStoneCoverFailureMechanismHelper.HasManualAssemblyResults(failureMechanism); + + // Assert + Assert.IsFalse(hasManualAssemblyResults); + } + } +} \ No newline at end of file Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/Ringtoets.WaveImpactAsphaltCover.Data.csproj =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -r13ba5757d5c7920c6070203275bf86adae620562 --- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/Ringtoets.WaveImpactAsphaltCover.Data.csproj (.../Ringtoets.WaveImpactAsphaltCover.Data.csproj) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/Ringtoets.WaveImpactAsphaltCover.Data.csproj (.../Ringtoets.WaveImpactAsphaltCover.Data.csproj) (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -20,6 +20,7 @@ + Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/WaveImpactAsphaltCoverFailureMechanismHelper.cs =================================================================== diff -u --- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/WaveImpactAsphaltCoverFailureMechanismHelper.cs (revision 0) +++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/WaveImpactAsphaltCoverFailureMechanismHelper.cs (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -0,0 +1,49 @@ +// 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.Linq; + +namespace Ringtoets.WaveImpactAsphaltCover.Data +{ + /// + /// Class containing helper methods for . + /// + public static class WaveImpactAsphaltCoverFailureMechanismHelper + { + /// + /// Determines if the failure mechanism has section assembly results that are manually overwritten. + /// + /// The . + /// true if the failure mechanism contains section assembly results that are manually overwritten, + /// false otherwise. + /// Thrown when is null. + public static bool HasManualAssemblyResults(WaveImpactAsphaltCoverFailureMechanism failureMechanism) + { + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + return failureMechanism.SectionResults.Any(sr => sr.UseManualAssemblyCategoryGroup); + } + } +} \ No newline at end of file Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/Ringtoets.WaveImpactAsphaltCover.Data.Test.csproj =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -r13ba5757d5c7920c6070203275bf86adae620562 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/Ringtoets.WaveImpactAsphaltCover.Data.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.Data.Test.csproj) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/Ringtoets.WaveImpactAsphaltCover.Data.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.Data.Test.csproj) (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -21,6 +21,7 @@ + Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverFailureMechanismHelperTest.cs =================================================================== diff -u --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverFailureMechanismHelperTest.cs (revision 0) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverFailureMechanismHelperTest.cs (revision 13ba5757d5c7920c6070203275bf86adae620562) @@ -0,0 +1,93 @@ +// 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.Linq; +using Core.Common.Base.Geometry; +using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; + +namespace Ringtoets.WaveImpactAsphaltCover.Data.Test +{ + [TestFixture] + public class WaveImpactAsphaltCoverFailureMechanismHelperTest + { + [Test] + public void HasManualAssemblyResults_FailureMechanismNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => WaveImpactAsphaltCoverFailureMechanismHelper.HasManualAssemblyResults(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanism", exception.ParamName); + } + + [Test] + public void HasManualAssemblyResults_FailureMechanismWithManualAssemblyResults_ReturnsTrue() + { + // Setup + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + FailureMechanismTestHelper.SetSections(failureMechanism, new[] + { + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }), + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }) + }); + failureMechanism.SectionResults.First().UseManualAssemblyCategoryGroup = true; + + // Call + bool hasManualAssemblyResults = WaveImpactAsphaltCoverFailureMechanismHelper.HasManualAssemblyResults(failureMechanism); + + // Assert + Assert.IsTrue(hasManualAssemblyResults); + } + + [Test] + public void HasManualAssemblyResults_FailureMechanismWithoutManualAssemblyResults_ReturnsFalse() + { + // Setup + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + FailureMechanismTestHelper.SetSections(failureMechanism, new[] + { + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }), + FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(0, 0) + }) + }); + + // Call + bool hasManualAssemblyResults = WaveImpactAsphaltCoverFailureMechanismHelper.HasManualAssemblyResults(failureMechanism); + + // Assert + Assert.IsFalse(hasManualAssemblyResults); + } + } +} \ No newline at end of file