Esempio n. 1
0
        public void ReturnAListOfTheCellsNeighbours()
        {
            var universe = new Universe();

            var world = universe.CreateEmptyWorld(4, 4);

            var  neighbourFetcher = new NeighbourFetcher();
            Cell cell             = new Cell()
            {
                X = 1,
                Y = 1
            };
            var neighbours = neighbourFetcher.GetAllNeighbours(world, cell);

            var deadCell = new Cell()
            {
                State = false
            };

            var expected = new List <Cell>();

            for (var i = 0; i < 8; i++)
            {
                expected.Add(deadCell);
            }

            CollectionAssert.AreEqual(expected, neighbours);
        }
Esempio n. 2
0
        public void GenerateAWorldOnCreation()
        {
            var universe      = new Universe();
            var expectedWorld = new List <List <Cell> >();

            for (var i = 0; i < 4; i++)
            {
                expectedWorld.Add(Enumerable.Repeat(new Cell(), 4).ToList());
            }
            var result = universe.CreateEmptyWorld(4, 4);

            CollectionAssert.AreEqual(expectedWorld, result);
        }