Exemple #1
0
        public void ToEliminateReturns6SquaresAroundTheShip8_9to9_9()
        {
            SquareTerminator terminator = new SquareTerminator(10, 10);
            var toEliminate             = terminator.ToEliminate(new List <Square> {
                new Square(8, 9), new Square(9, 9)
            });

            Assert.AreEqual(6, toEliminate.Count());
            Assert.IsTrue(toEliminate.Contains(new Square(7, 8)));
            Assert.IsTrue(toEliminate.Contains(new Square(7, 9)));
            Assert.IsTrue(toEliminate.Contains(new Square(9, 8)));
            Assert.IsTrue(toEliminate.Contains(new Square(9, 9)));
        }
Exemple #2
0
        public void ToEliminateReturns8SquaresAroundTheShip0_3to0_5()
        {
            SquareTerminator terminator = new SquareTerminator(10, 10);
            var toEliminate             = terminator.ToEliminate(new List <Square> {
                new Square(0, 3), new Square(0, 4)
            });

            Assert.AreEqual(8, toEliminate.Count());
            Assert.IsTrue(toEliminate.Contains(new Square(0, 2)));
            Assert.IsTrue(toEliminate.Contains(new Square(1, 2)));
            Assert.IsTrue(toEliminate.Contains(new Square(1, 5)));
            Assert.IsTrue(toEliminate.Contains(new Square(0, 5)));
        }
Exemple #3
0
        public void ToEliminateReturns6SquaresAroundTheShip0_0to0_1()
        {
            SquareTerminator terminator = new SquareTerminator(10, 10);
            var toEliminate             = terminator.ToEliminate(new List <Square> {
                new Square(0, 0), new Square(0, 1)
            });

            Assert.AreEqual(6, toEliminate.Count());
            Assert.IsTrue(toEliminate.Contains(new Square(0, 0)));
            Assert.IsTrue(toEliminate.Contains(new Square(1, 0)));
            Assert.IsTrue(toEliminate.Contains(new Square(1, 2)));
            Assert.IsTrue(toEliminate.Contains(new Square(0, 2)));
        }
Exemple #4
0
        public void ToEliminateReturns18SquaresAroundTheShip4_3to4_6()
        {
            SquareTerminator terminator = new SquareTerminator(10, 10);
            var toEliminate             = terminator.ToEliminate(new List <Square> {
                new Square(4, 3), new Square(4, 4), new Square(4, 5), new Square(4, 6)
            });

            Assert.AreEqual(18, toEliminate.Count());
            Assert.IsTrue(toEliminate.Contains(new Square(3, 2)));
            Assert.IsTrue(toEliminate.Contains(new Square(5, 2)));
            Assert.IsTrue(toEliminate.Contains(new Square(3, 7)));
            Assert.IsTrue(toEliminate.Contains(new Square(5, 7)));
        }