コード例 #1
0
        public void RecordSurvivorLevelUp()
        {
            var game   = new Game();
            var John   = new Survivor("John", 6);
            var Whaley = new Survivor("Whaley", 10);

            game.AddSurvivorToGame(John);
            game.AddSurvivorToGame(Whaley);
            John.KilledZombie();
            var newLevel = John.Level;

            var lastEvent = game.GameHistory.LastOrDefault();

            Assert.IsNotNull(lastEvent);
            Assert.IsTrue(lastEvent.EventDetail.StartsWith($"{John.Name} has leveled up  and is now {newLevel}"));
        }
コード例 #2
0
        public void RecordGameLevelUp()
        {
            var game   = new Game();
            var John   = new Survivor("John", 6);
            var Whaley = new Survivor("Whaley", 4);

            game.AddSurvivorToGame(John);
            game.AddSurvivorToGame(Whaley);

            var gameLevelBefore = game.Level;

            John.KilledZombie();
            var newGameLevel = game.Level;

            game.RecordAnyGameLevelChange(gameLevelBefore);
            var lastEvent = game.GameHistory.LastOrDefault();

            Assert.IsNotNull(lastEvent);
            Assert.IsTrue(lastEvent.EventDetail.StartsWith($"The game level is now {newGameLevel}!"));
        }