// 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.Collections.Generic; using System.Linq; using Core.Common.Base.Geometry; using NUnit.Framework; using Ringtoets.AssemblyTool.Data; using Ringtoets.Integration.IO.Assembly; namespace Ringtoets.Integration.IO.TestUtil { /// /// Helper class to assert /// public static class ExportableFailureMechanismTestHelper { /// /// Asserts the default failure mechanism. /// /// The expected geometry of the section it contains. /// The expected . /// The expected . /// The expected which is used /// to generate a failure mechanism assembly result. /// The to assert. /// Thrown when: /// /// The geometry defined by does not match with the section contained in . /// The values in do not match with /// , or . /// public static void AssertDefaultFailureMechanismWithProbability(IEnumerable geometry, ExportableFailureMechanismType failureMechanismCode, ExportableFailureMechanismGroup group, ExportableAssemblyMethod failureMechanismAssemblyMethod, ExportableFailureMechanism exportableFailureMechanism) { Assert.AreEqual(group, exportableFailureMechanism.Group); Assert.AreEqual(failureMechanismCode, exportableFailureMechanism.Code); ExportableFailureMechanismAssemblyResultWithProbability failureMechanismAssemblyResult = exportableFailureMechanism.FailureMechanismAssembly; Assert.AreEqual(failureMechanismAssemblyMethod, failureMechanismAssemblyResult.AssemblyMethod); Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, failureMechanismAssemblyResult.AssemblyCategory); Assert.AreEqual(0, failureMechanismAssemblyResult.Probability); var exportableFailureMechanismSectionAssembly = (ExportableAggregatedFailureMechanismSectionAssemblyWithCombinedProbabilityResult) exportableFailureMechanism.SectionAssemblyResults.Single(); ExportableSectionAssemblyResultWithProbability combinedAssembly = exportableFailureMechanismSectionAssembly.CombinedAssembly; Assert.AreEqual(ExportableAssemblyMethod.WBI0A1, combinedAssembly.AssemblyMethod); Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, combinedAssembly.AssemblyCategory); Assert.AreEqual(0, combinedAssembly.Probability); ExportableFailureMechanismSection failureMechanismSection = exportableFailureMechanismSectionAssembly.FailureMechanismSection; Assert.AreSame(geometry, failureMechanismSection.Geometry); Assert.AreEqual(0, failureMechanismSection.StartDistance); Assert.AreEqual(Math2D.Length(geometry), failureMechanismSection.EndDistance); } } }