Ejemplo n.º 1
0
        public void HexagonNet_RemoveTopRow_RemovesTheRowFromNet()
        {
            // arrange
            HexagonNet <Bubble> net = HexagonNetTestHelper.GenerateTestNet3Rows(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17);

            var expectedNetToString = $" 6 7 8 9 10 11{Environment.NewLine}" +
                                      $" 12 13 14 15 16 17{Environment.NewLine}";

            // act
            net.RemoveTopRow();

            // assert
            Assert.AreEqual(expectedNetToString, net.ToString(), $"Actual HexagonNet as string: {Environment.NewLine}{net.ToString()}");
        }
Ejemplo n.º 2
0
        public void HexagonNet_RemoveTopRow_ReassignsNeighbours()
        {
            // arrange
            HexagonNet <Bubble> net = HexagonNetTestHelper.GenerateTestNet3Rows(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17);

            // act
            net.RemoveTopRow();
            var topRowNodes = net.TopRow.Nodes;

            // assert
            Assert.AreEqual(null, topRowNodes[0].GetNeighbour(Neighbours.UpperLeft));
            Assert.AreEqual(null, topRowNodes[0].GetNeighbour(Neighbours.UpperRight));
            Assert.AreEqual(null, topRowNodes[1].GetNeighbour(Neighbours.UpperLeft));
            Assert.AreEqual(null, topRowNodes[1].GetNeighbour(Neighbours.UpperRight));
            Assert.AreEqual(null, topRowNodes[2].GetNeighbour(Neighbours.UpperLeft));
            Assert.AreEqual(null, topRowNodes[2].GetNeighbour(Neighbours.UpperRight));
            Assert.AreEqual(null, topRowNodes[3].GetNeighbour(Neighbours.UpperLeft));
            Assert.AreEqual(null, topRowNodes[3].GetNeighbour(Neighbours.UpperRight));
            Assert.AreEqual(null, topRowNodes[4].GetNeighbour(Neighbours.UpperLeft));
            Assert.AreEqual(null, topRowNodes[4].GetNeighbour(Neighbours.UpperRight));
            Assert.AreEqual(null, topRowNodes[5].GetNeighbour(Neighbours.UpperLeft));
            Assert.AreEqual(null, topRowNodes[5].GetNeighbour(Neighbours.UpperRight));
        }