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 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); }