public void GeneratePoints() { var island = new IslandEntity { Corners = new[] { new GeoPoint(0, 0), new GeoPoint(2, 0), new GeoPoint(2, 2), new GeoPoint(0, 2) } }; var actual = island.GeneratePoints(); var expected = new List<GeoPoint>(); for (int x = 0; x < 3; x++) for (int y = 0; y < 3; y++) expected.Add(new GeoPoint { X = x, Y = y }); CollectionAssert.AreEquivalent(expected, actual); }
public void GenerateIslandCase1() { var island = new IslandEntity { Corners = new[] { new GeoPoint(1, 1), new GeoPoint(3, 1), new GeoPoint(3, 3), new GeoPoint(1, 3) } }; var points = island.GeneratePoints(); Assert.True(points.Contains(new GeoPoint(1, 1))); Assert.True(points.Contains(new GeoPoint(2, 1))); Assert.True(points.Contains(new GeoPoint(3, 1))); Assert.True(points.Contains(new GeoPoint(1, 2))); Assert.True(points.Contains(new GeoPoint(2, 2))); Assert.True(points.Contains(new GeoPoint(3, 2))); Assert.True(points.Contains(new GeoPoint(1, 3))); Assert.True(points.Contains(new GeoPoint(2, 3))); Assert.True(points.Contains(new GeoPoint(3, 3))); }
public void GeneratePoints() { var island = new IslandEntity { Corners = new[] { new GeoPoint(0, 0), new GeoPoint(2, 0), new GeoPoint(2, 2), new GeoPoint(0, 2) } }; var actual = island.GeneratePoints(); var expected = new List <GeoPoint>(); for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { expected.Add(new GeoPoint { X = x, Y = y }); } } CollectionAssert.AreEquivalent(expected, actual); }
public void AddIsland(IslandEntity island) { foreach (var item in island.GeneratePoints()) { var point = new GeoPoint(item.X, item.Y); points.Add(point, LocationType.Ground); } }