using System.Collections.Generic; using System.Linq; using Core.Common.Base.Geometry; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.IO.Assembly; namespace Ringtoets.Integration.IO.TestUtil { /// /// Helper class to assert /// public static class ExportableFailureMechanismSectionTestHelper { /// /// Asserts a collection of /// against a collection of . /// /// The expected . /// The actual to assert against. /// Thrown when: /// /// The number of sections between and /// do not match. /// The geometry of any the sections are not equal. /// public static void AssertExportableFailureMechanismSections(IEnumerable expectedSections, IEnumerable actualSections) { int expectedNrOfSections = expectedSections.Count(); Assert.AreEqual(expectedNrOfSections, actualSections.Count()); double expectedStartDistance = 0; for (var i = 0; i < expectedNrOfSections; i++) { FailureMechanismSection expectedSection = expectedSections.ElementAt(i); ExportableFailureMechanismSection actualSection = actualSections.ElementAt(i); double expectedEndDistance = expectedStartDistance + Math2D.Length(expectedSection.Points); Assert.AreEqual(expectedStartDistance, actualSection.StartDistance); Assert.AreEqual(expectedEndDistance, actualSection.EndDistance); CollectionAssert.AreEqual(expectedSection.Points, actualSection.Geometry); expectedStartDistance = expectedEndDistance; } } } }