예제 #1
0
        public void DistanceTraveledShortest(double xPos, double yPos, double expected)
        {
            // This should yield a distance of 5.
            var testCoord = new GridCoordinate(xPos, yPos);

            var shortestResult = testCoord.DistanceTraveledFromOrigin(DistanceCalculationMode.ShortestPath);

            Assert.Equal(expected, shortestResult);
        }
예제 #2
0
        public void DistanceTraveledXandYComponents(double xPos, double yPos)
        {
            var testCoord = new GridCoordinate(xPos, yPos);

            var addedResult = testCoord.DistanceTraveledFromOrigin(DistanceCalculationMode.XComponentPlusYComponent);

            double expected = Math.Abs(xPos) + Math.Abs(yPos);

            Assert.Equal(expected, addedResult);
        }