public void MakeSectionSegments_ValidFailureMechanismSections_ReturnSectionSegmentsFromFailureMechanismSection()
        {
            // Setup
            FailureMechanismSection[] failureMechanismSections =
            {
                new FailureMechanismSection(string.Empty, new[]
                {
                    new Point2D(0, 0)
                }),
                new FailureMechanismSection(string.Empty, new[]
                {
                    new Point2D(1, 1)
                }),
                new FailureMechanismSection(string.Empty, new[]
                {
                    new Point2D(2, 2)
                }),
                new FailureMechanismSection(string.Empty, new[]
                {
                    new Point2D(3, 3)
                })
            };

            // Call
            SectionSegments[] segmentSections = SectionSegmentsHelper.MakeSectionSegments(failureMechanismSections);

            // Assert
            Assert.AreEqual(failureMechanismSections.Length, segmentSections.Length);
            CollectionAssert.AreEqual(failureMechanismSections, segmentSections.Select(ss => ss.Section));
        }
        public void GetSectionForPoint_PointOnSection_ReturnSection()
        {
            // Setup
            var failureMechanismSection1 = new FailureMechanismSection(string.Empty, new[]
            {
                new Point2D(0, 0),
                new Point2D(2, 2)
            });
            var failureMechanismSection2 = new FailureMechanismSection(string.Empty, new[]
            {
                new Point2D(10, 10),
                new Point2D(12, 12)
            });

            SectionSegments[] sectionSegments =
            {
                new SectionSegments(failureMechanismSection1),
                new SectionSegments(failureMechanismSection2)
            };

            // Call
            FailureMechanismSection sectionForPoint = SectionSegmentsHelper.GetSectionForPoint(sectionSegments, new Point2D(11, 11));

            // Assert
            Assert.AreSame(failureMechanismSection2, sectionForPoint);
        }
        public void GetSectionForPoint_SectionSegmentsEmpty_ReturnNull()
        {
            // Call
            FailureMechanismSection section = SectionSegmentsHelper.GetSectionForPoint(Enumerable.Empty <SectionSegments>(), new Point2D(0, 0));

            // Assert
            Assert.IsNull(section);
        }
        public void GetSectionForPoint_SectionSegmentsNull_ThrowsArgumentNullException()
        {
            // Call
            TestDelegate test = () => SectionSegmentsHelper.GetSectionForPoint(null, new Point2D(0, 0));

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(test);

            Assert.AreEqual("sectionSegmentsCollection", exception.ParamName);
        }
        public void MakeSectionSegments_SectionsNull_ThrowsArgumentNullException()
        {
            // Call
            TestDelegate test = () => SectionSegmentsHelper.MakeSectionSegments(null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(test);

            Assert.AreEqual("sections", exception.ParamName);
        }
        public void MakeSectionSegments_SectionsElementNull_ThrowsArgumentNullException()
        {
            // Call
            TestDelegate test = () => SectionSegmentsHelper.MakeSectionSegments(new FailureMechanismSection[]
            {
                null
            });

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(test);

            Assert.AreEqual("section", exception.ParamName);
        }
        public void GetSectionForPoint_PointNull_ThrowsArgumentNullException()
        {
            // Setup
            SectionSegments[] sectionSegments =
            {
                new SectionSegments(new FailureMechanismSection(string.Empty, new[]
                {
                    new Point2D(0, 0),
                    new Point2D(2, 2)
                }))
            };

            // Call
            TestDelegate test = () => SectionSegmentsHelper.GetSectionForPoint(sectionSegments, null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(test);

            Assert.AreEqual("point", exception.ParamName);
        }