// 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 NUnit.Framework; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.IllustrationPoints; using Ringtoets.Common.Data.Probability; using Ringtoets.Common.Data.Structures; using CoreCloneAssert = Core.Common.Data.TestUtil.CloneAssert; namespace Ringtoets.Common.Data.TestUtil { /// /// Class that defines methods for asserting whether two objects are clones. /// public static class CloneAssert { /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(BreakWater original, BreakWater clone) { Assert.AreEqual(original.Type, clone.Type); Assert.AreEqual(original.Height, clone.Height); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(ProbabilityAssessmentOutput original, ProbabilityAssessmentOutput clone) { Assert.AreEqual(original.RequiredProbability, clone.RequiredProbability); Assert.AreEqual(original.RequiredReliability, clone.RequiredReliability); Assert.AreEqual(original.Probability, clone.Probability); Assert.AreEqual(original.Reliability, clone.Reliability); Assert.AreEqual(original.FactorOfSafety, clone.FactorOfSafety); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(Comment original, Comment clone) { Assert.AreEqual(original.Body, clone.Body); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(WindDirection original, WindDirection clone) { Assert.AreEqual(original.Name, clone.Name); Assert.AreEqual(original.Angle, clone.Angle); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(Stochast original, Stochast clone) { Assert.AreEqual(original.Name, clone.Name); Assert.AreEqual(original.Alpha, clone.Alpha); Assert.AreEqual(original.Duration, clone.Duration); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(SubMechanismIllustrationPointStochast original, SubMechanismIllustrationPointStochast clone) { AreClones((Stochast) original, clone); Assert.AreEqual(original.Realization, clone.Realization); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(TopLevelIllustrationPointBase original, TopLevelIllustrationPointBase clone) { CoreCloneAssert.AreObjectClones(original.WindDirection, clone.WindDirection, AreClones); Assert.AreEqual(original.ClosingSituation, clone.ClosingSituation); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(TopLevelSubMechanismIllustrationPoint original, TopLevelSubMechanismIllustrationPoint clone) { AreClones((TopLevelIllustrationPointBase) original, clone); CoreCloneAssert.AreObjectClones(original.SubMechanismIllustrationPoint, clone.SubMechanismIllustrationPoint, AreClones); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(TopLevelFaultTreeIllustrationPoint original, TopLevelFaultTreeIllustrationPoint clone) { AreClones((TopLevelIllustrationPointBase) original, clone); CoreCloneAssert.AreObjectClones(original.FaultTreeNodeRoot, clone.FaultTreeNodeRoot, AreClones); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(IllustrationPointResult original, IllustrationPointResult clone) { Assert.AreEqual(original.Description, clone.Description); Assert.AreEqual(original.Value, clone.Value); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(IllustrationPointBase original, IllustrationPointBase clone) { Assert.AreEqual(original.Name, clone.Name); Assert.AreEqual(original.Beta, clone.Beta); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(SubMechanismIllustrationPoint original, SubMechanismIllustrationPoint clone) { AreClones((IllustrationPointBase) original, clone); CoreCloneAssert.AreEnumerationClones(original.Stochasts, clone.Stochasts, AreClones); CoreCloneAssert.AreEnumerationClones(original.IllustrationPointResults, clone.IllustrationPointResults, AreClones); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(FaultTreeIllustrationPoint original, FaultTreeIllustrationPoint clone) { AreClones((IllustrationPointBase) original, clone); CoreCloneAssert.AreEnumerationClones(original.Stochasts, clone.Stochasts, AreClones); Assert.AreEqual(original.CombinationType, clone.CombinationType); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(IllustrationPointNode original, IllustrationPointNode clone) { CoreCloneAssert.AreObjectClones(original.Data, clone.Data, AreClones); CoreCloneAssert.AreEnumerationClones(original.Children, clone.Children, AreClones); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(GeneralResult original, GeneralResult clone) { CoreCloneAssert.AreObjectClones(original.GoverningWindDirection, clone.GoverningWindDirection, AreClones); CoreCloneAssert.AreEnumerationClones(original.Stochasts, clone.Stochasts, AreClones); CoreCloneAssert.AreEnumerationClones(original.TopLevelIllustrationPoints, clone.TopLevelIllustrationPoints, AreClones); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(GeneralResult original, GeneralResult clone) { CoreCloneAssert.AreObjectClones(original.GoverningWindDirection, clone.GoverningWindDirection, AreClones); CoreCloneAssert.AreEnumerationClones(original.Stochasts, clone.Stochasts, AreClones); CoreCloneAssert.AreEnumerationClones(original.TopLevelIllustrationPoints, clone.TopLevelIllustrationPoints, AreClones); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(StructuresInputBase original, StructuresInputBase clone) where T : StructureBase { CoreCloneAssert.AreObjectClones(original.ModelFactorSuperCriticalFlow, clone.ModelFactorSuperCriticalFlow, DistributionAssert.AreEqual); CoreCloneAssert.AreObjectClones(original.AllowedLevelIncreaseStorage, clone.AllowedLevelIncreaseStorage, DistributionAssert.AreEqual); CoreCloneAssert.AreObjectClones(original.StorageStructureArea, clone.StorageStructureArea, DistributionAssert.AreEqual); CoreCloneAssert.AreObjectClones(original.FlowWidthAtBottomProtection, clone.FlowWidthAtBottomProtection, DistributionAssert.AreEqual); CoreCloneAssert.AreObjectClones(original.CriticalOvertoppingDischarge, clone.CriticalOvertoppingDischarge, DistributionAssert.AreEqual); CoreCloneAssert.AreObjectClones(original.WidthFlowApertures, clone.WidthFlowApertures, DistributionAssert.AreEqual); CoreCloneAssert.AreObjectClones(original.StormDuration, clone.StormDuration, DistributionAssert.AreEqual); Assert.AreSame(original.Structure, clone.Structure); Assert.AreEqual(original.StructureNormalOrientation, clone.StructureNormalOrientation); Assert.AreEqual(original.FailureProbabilityStructureWithErosion, clone.FailureProbabilityStructureWithErosion); Assert.AreSame(original.ForeshoreProfile, clone.ForeshoreProfile); Assert.AreEqual(original.ShouldIllustrationPointsBeCalculated, clone.ShouldIllustrationPointsBeCalculated); Assert.AreSame(original.HydraulicBoundaryLocation, clone.HydraulicBoundaryLocation); Assert.AreEqual(original.UseBreakWater, clone.UseBreakWater); CoreCloneAssert.AreObjectClones(original.BreakWater, clone.BreakWater, AreClones); Assert.AreEqual(original.UseForeshore, clone.UseForeshore); } /// /// Method that asserts whether and /// are clones. /// /// The original object. /// The cloned object. /// Thrown when and /// are not clones. public static void AreClones(StructuresOutput original, StructuresOutput clone) { CoreCloneAssert.AreObjectClones(original.ProbabilityAssessmentOutput, clone.ProbabilityAssessmentOutput, AreClones); CoreCloneAssert.AreObjectClones(original.GeneralResult, clone.GeneralResult, AreClones); } } }