public void TestJsonDeserialization()
        {
            // Given
            CoordinateFlipper flipper;
            var game = CreateInterestingGameState(out flipper);
            var renderer = new SpaceInvadersRenderer();

            var state = renderer.Render(game).State;
            var mapReal = renderer.Render(game).Map;
            Debug.WriteLine("Map:");
            Debug.WriteLine(mapReal);

            // Prevent further shooting as that introduces randomness
            game.GetPlayer(1).AlienManager.TestPreventAllAliensShoot();
            game.GetPlayer(2).AlienManager.TestPreventAllAliensShoot();
            for (var i = 0; i < 5; i++)
            {
                game.Update();
                //Debug.WriteLine("");
                mapReal = renderer.Render(game).Map;
                //Debug.WriteLine(mapReal);
            }

            // When
            var match = JsonConvert.DeserializeObject<Match>(state,
                new JsonSerializerSettings
                {
                    Converters = {new EntityConverter()},
                    NullValueHandling = NullValueHandling.Ignore
                }
                );
            Match.SetInstance(match);

            // Prevent further shooting as that introduces randomness
            var mapPredicted = renderer.Render(match).Map;
            match.GetPlayer(1).AlienManager.TestPreventAllAliensShoot();
            match.GetPlayer(2).AlienManager.TestPreventAllAliensShoot();
            for (var i = 0; i < 5 + 1; i++)
            {
                match.Update();
                //Debug.WriteLine("");
                mapPredicted = renderer.Render(game).Map;
                //Debug.WriteLine(mapPredicted);
            }

            Debug.WriteLine("");
            Debug.WriteLine("Map predicted:");
            Debug.WriteLine(mapPredicted);

            // Then
            Assert.AreEqual(mapReal, mapPredicted);
        }
        public void TestMissilesOneDoesNotKillTwo()
        {
            // Given
            var renderer = new SpaceInvadersRenderer();
            var game = Match.GetInstance();
            game.StartNewGame();
            var map = game.Map;

            var player = game.GetPlayer(1);
            var ship = player.Ship;
            var aliens = game.GetPlayer(2).AlienManager;
            var player2 = game.GetPlayer(2);
            var killsBefore = player2.Kills;

            // When
            //add them in the order the harness would add them
            var missile1 = new Missile(1) { X = ship.X, Y = ship.Y - 3 };
            map.AddEntity(missile1);

            var missile3 = new Missile(2) { X = ship.X, Y = ship.Y - 4 };
            map.AddEntity(missile3);
            var missile4 = new Missile(2) { X = ship.X, Y = ship.Y - 5 };
            map.AddEntity(missile4);

            // Then
            Console.WriteLine(renderer.Render(game).Map);

            game.Update();
            Console.WriteLine(renderer.Render(game).Map);

            Assert.IsFalse(missile1.Alive, "Missile 1 wasn't destroyed.");
            Assert.IsFalse(missile3.Alive, "Missile 3 wasn't destroyed.");
            Assert.IsTrue(missile4.Alive, "Missile 4 was destroyed.");
        }