public void AdjacencyAllPointsMethodWorks() { var centrePoint = new XYPoint(0, 0); var actualOutput = centrePoint.GetAllAdjacentPoints(); var expectedOutput = new[] { new XYPoint(0, 1), new XYPoint(1, 1), new XYPoint(1, 0), new XYPoint(1, -1), new XYPoint(0, -1), new XYPoint(-1, -1), new XYPoint(-1, 0), new XYPoint(-1, 1) }; CollectionAssert.AreEqual(expectedOutput, actualOutput); }
public void AdjacencyMethodsWithDefaultParametersWorkAsPerPrimaryMethod(int centreX, int centreY) { var centrePoint = new XYPoint(centreX, centreY); CollectionAssert.AreEqual(centrePoint.GetAllAdjacentPoints(), centrePoint.GetAdjacentPoints()); CollectionAssert.AreEqual(centrePoint.GetAllAdjacentPoints(), centrePoint.GetAdjacentPoints(eDirection.North, eDirectionChange.Clockwise, adjacencyType: XYPoint.eAdjacencyType.All)); CollectionAssert.AreEqual(centrePoint.GetAllAdjacentPoints(eDirection.South), centrePoint.GetAdjacentPoints(eDirection.South)); CollectionAssert.AreEqual(centrePoint.GetAllAdjacentPoints(eDirection.South), centrePoint.GetAdjacentPoints(eDirection.South, eDirectionChange.Clockwise, XYPoint.eAdjacencyType.All)); CollectionAssert.AreEqual(centrePoint.GetAllAdjacentPoints(eDirection.West, eDirectionChange.AntiClockwise), centrePoint.GetAdjacentPoints(eDirection.West, eDirectionChange.AntiClockwise)); CollectionAssert.AreEqual(centrePoint.GetAllAdjacentPoints(eDirection.West, eDirectionChange.AntiClockwise), centrePoint.GetAdjacentPoints(eDirection.West, eDirectionChange.AntiClockwise, XYPoint.eAdjacencyType.All)); CollectionAssert.AreEqual(centrePoint.GetEdgeAdjacentPoints(), centrePoint.GetAdjacentPoints(adjacencyType: XYPoint.eAdjacencyType.Orthogonal)); CollectionAssert.AreEqual(centrePoint.GetEdgeAdjacentPoints(), centrePoint.GetAdjacentPoints(eDirection.North, eDirectionChange.Clockwise, XYPoint.eAdjacencyType.Orthogonal)); CollectionAssert.AreEqual(centrePoint.GetEdgeAdjacentPoints(eDirection.South), centrePoint.GetAdjacentPoints(eDirection.South, eDirectionChange.Clockwise, XYPoint.eAdjacencyType.Orthogonal)); CollectionAssert.AreEqual(centrePoint.GetEdgeAdjacentPoints(eDirection.West, eDirectionChange.AntiClockwise), centrePoint.GetAdjacentPoints(eDirection.West, eDirectionChange.AntiClockwise, XYPoint.eAdjacencyType.Orthogonal)); }