public void FloorPlan_detects_adjacent_tiles() { FloorPlan plan = NSubstitute.Substitute.For <FloorPlan>(); plan.FloorTiles.AddRange(_FillArea(5, 5)); var center = plan.GetFloorTile(2, 2); plan.GetNorth(center).Should().BeSameAs(plan.GetFloorTile(2, 1)); plan.GetSouth(center).Should().BeSameAs(plan.GetFloorTile(2, 3)); plan.GetWest(center).Should().BeSameAs(plan.GetFloorTile(1, 2)); plan.GetEast(center).Should().BeSameAs(plan.GetFloorTile(3, 2)); plan.GetNorth(center).Should().NotBeSameAs(plan.GetFloorTile(2, 3)); var corner = plan.GetFloorTile(0, 0); plan.GetNorth(corner).Should().BeNull(); plan.GetSouth(corner).Should().BeSameAs(plan.GetFloorTile(0, 1)); plan.GetWest(corner).Should().BeNull(); plan.GetEast(corner).Should().BeSameAs(plan.GetFloorTile(1, 0)); corner = plan.GetFloorTile(4, 4); plan.GetNorth(corner).Should().BeSameAs(plan.GetFloorTile(4, 3)); plan.GetSouth(corner).Should().BeNull(); plan.GetWest(corner).Should().BeSameAs(plan.GetFloorTile(3, 4)); plan.GetEast(corner).Should().BeNull(); }