Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 4
0
 public bool IntersectsWith(Line2D otherLine)
 {
     return Slope() != otherLine.Slope();
 }