public void Slope_AtypicalSlope_ReturnsSlope() { Line2D sut = new Line2D(new Point(0, 0), new Point(4, 4)); decimal result = sut.Slope(); result.ShouldBe((decimal)1); }
public void Slope_FlatSlope_Returns0() { Line2D sut = new Line2D(new Point(0, 0), new Point(4, 0)); decimal result = sut.Slope(); result.ShouldBe((decimal)0); }
public void Slope_InfiniteSlope_ReturnsSlope() { Line2D sut = new Line2D(new Point(0, 0), new Point(0, 4)); bool thrown = false; try { sut.Slope(); } catch (DivideByZeroException) { thrown = true; } thrown.ShouldBe(true); }
public bool IntersectsWith(Line2D otherLine) { return Slope() != otherLine.Slope(); }