Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
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);
        }
Beispiel #4
0
 public bool IntersectsWith(Line2D otherLine)
 {
     return Slope() != otherLine.Slope();
 }