示例#1
0
            public void TestGameRunning()
            {
                Game.Start(3);

                Assert.AreEqual(3, Game.Obstacles.Count);
                Assert.AreEqual(0, Game.Blasts.Count);
                Assert.AreNotEqual(0, Game.Player.Speed);
            }
示例#2
0
            public void TestSingleShotFiring()
            {
                var game = new GameModel(Sizes.Collection["game"], new Point(20, 100));

                game.Start(0);
                game.Fire();

                Assert.AreEqual(1, game.Blasts.Count);
            }
示例#3
0
            public void TestObstacleIntersectionWithPlayer()
            {
                var game = new GameModel(Sizes.Collection["game"], new Point(20, 100));

                game.Start(1);
                var obstacle = game.Obstacles.First();

                obstacle.SetLocation(20, 100);

                Assert.AreEqual(true, obstacle.IntersectsWithPlayer(game.Player));
            }
示例#4
0
            public void TestShootingLimitation()
            {
                var game = new GameModel(Sizes.Collection["game"], new Point(20, 100));

                game.Start(0);
                game.ShotsLimit = 2;

                for (var i = 0; i < 3; i++)
                {
                    game.Fire();
                }

                Assert.AreEqual(2, game.Blasts.Count);
            }
示例#5
0
            public void TestSeveralShotsFiring()
            {
                var game = new GameModel(Sizes.Collection["game"], new Point(20, 100));

                game.Start(0);
                game.ShotsLimit = 7;
                var shotsCount = new Random().Next(0, 6);

                for (var i = 0; i < shotsCount; i++)
                {
                    game.Fire();
                }

                Assert.AreEqual(shotsCount, game.Blasts.Count);
            }
示例#6
0
 private void Start()
 {
     _game.Start(true);
 }