Exemplo n.º 1
0
        public void Move(Directions direction, int[] expected)
        {
            var random_mock = new DeterministicRandomizer();

            random_mock.Enqueue(new[] { 0, 0,
                                        4, 0,
                                        2, 0 });
            var g = new Game(random_mock);

            g.Move(direction);
            CollectionAssert.AreEqual(expected, g.Board);
        }
Exemplo n.º 2
0
        public void Score(Directions direction, int expected_score, int[] spawn_pos)
        {
            var random_mock = new DeterministicRandomizer();
            var spawns      = spawn_pos.SelectMany(s => new[] { s, 0 });

            random_mock.Enqueue(spawns);
            var g = new Game(random_mock);

            Console.WriteLine(g);
            g.Move(direction);
            Console.WriteLine(g);
            Assert.AreEqual(expected_score, g.Score);
        }
Exemplo n.º 3
0
        public void Spawn4()
        {
            var random_mock = new DeterministicRandomizer();

            random_mock.Enqueue(new[] { 0, 9, 0, 9 });
            var g = new Game(random_mock);

            CollectionAssert.AreEqual(new[] {
                4, 4, 0, 0,
                0, 0, 0, 0,
                0, 0, 0, 0,
                0, 0, 0, 0,
            }, g.Board);
        }
Exemplo n.º 4
0
        public void DoNotCreateWithoutMove()
        {
            var random_mock = new DeterministicRandomizer();

            random_mock.Enqueue(new[] { 0, 0, 0, 0, 0, 0 });
            var g = new Game(random_mock);

            g.Move(Directions.Up);
            CollectionAssert.AreEqual(new[] {
                2, 2, 0, 0,
                0, 0, 0, 0,
                0, 0, 0, 0,
                0, 0, 0, 0,
            }, g.Board);
        }
Exemplo n.º 5
0
 public void Setup()
 {
     random_mock = new DeterministicRandomizer();
     random_mock.Enqueue(new[] { 0, 0, 4, 0 });
     g = new Game(random_mock);
 }