// 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 NUnit.Framework; using Ringtoets.AssemblyTool.Data; using Ringtoets.Integration.Forms.PropertyClasses; namespace Ringtoets.Integration.Forms.TestUtil { /// /// Class that can be used to assert property classes related to assembly categories. /// public static class AssemblyCategoryPropertiesTestHelper { /// /// Asserts whether the content of equals the given /// and . /// /// The collection of expected . /// The collection of expected . /// The actual to assert. /// Thrown when the content of does not equal /// and . public static void AssertFailureMechanismAndFailureMechanismSectionAssemblyCategoryProperties( IEnumerable expectedFailureMechanismCategories, IEnumerable expectedFailureMechanismSectionCategories, FailureMechanismAssemblyCategoriesProperties properties) { Assert.AreEqual(expectedFailureMechanismCategories.Count(), properties.FailureMechanismAssemblyCategories.Length); for (var i = 0; i < expectedFailureMechanismCategories.Count(); i++) { FailureMechanismAssemblyCategory category = expectedFailureMechanismCategories.ElementAt(i); FailureMechanismAssemblyCategoryProperties property = properties.FailureMechanismAssemblyCategories[i]; Assert.AreEqual(category.Group, property.Group); Assert.AreEqual(category.UpperBoundary, property.UpperBoundary); Assert.AreEqual(category.LowerBoundary, property.LowerBoundary); } AssertFailureMechanismSectionAssemblyCategoryProperties(expectedFailureMechanismSectionCategories, properties); } /// /// Asserts whether the content of equals the given /// and . /// /// The collection of expected . /// The actual to assert. /// Thrown when the content of does not equal /// . public static void AssertFailureMechanismAssemblyCategoryProperties( IEnumerable expectedFailureMechanismCategories, AssemblyResultCategoriesProperties properties) { Assert.AreEqual(expectedFailureMechanismCategories.Count(), properties.AssemblyCategories.Length); for (var i = 0; i < expectedFailureMechanismCategories.Count(); i++) { FailureMechanismAssemblyCategory category = expectedFailureMechanismCategories.ElementAt(i); FailureMechanismAssemblyCategoryProperties property = properties.AssemblyCategories[i]; Assert.AreEqual(category.Group, property.Group); Assert.AreEqual(category.UpperBoundary, property.UpperBoundary); Assert.AreEqual(category.LowerBoundary, property.LowerBoundary); } } /// /// Asserts whether the content of equals the given /// . /// /// The collection of expected . /// The actual to assert. /// Thrown when the content of does not equal /// . public static void AssertFailureMechanismSectionAssemblyCategoryProperties(IEnumerable expectedFailureMechanismSectionCategories, FailureMechanismSectionAssemblyCategoriesProperties properties) { Assert.AreEqual(expectedFailureMechanismSectionCategories.Count(), properties.FailureMechanismSectionAssemblyCategories.Length); for (var i = 0; i < expectedFailureMechanismSectionCategories.Count(); i++) { FailureMechanismSectionAssemblyCategory category = expectedFailureMechanismSectionCategories.ElementAt(i); FailureMechanismSectionAssemblyCategoryProperties property = properties.FailureMechanismSectionAssemblyCategories[i]; Assert.AreEqual(category.Group, property.Group); Assert.AreEqual(category.UpperBoundary, property.UpperBoundary); Assert.AreEqual(category.LowerBoundary, property.LowerBoundary); } } } }