예제 #1
0
        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);
        }
예제 #2
0
        public void GetSectionForPoint_SectionSegmentsEmpty_ReturnNull()
        {
            // Call
            FailureMechanismSection section = SectionSegmentsHelper.GetSectionForPoint(Enumerable.Empty <SectionSegments>(), new Point2D(0, 0));

            // Assert
            Assert.IsNull(section);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }