示例#1
0
 private int PointsForAppleType(AppleKind kind)
 {
     switch(kind)
       {
       case AppleKind.Normal: return PointsForEatingApple;
       case AppleKind.Super: return PointsForEatingSuperApple;
       case AppleKind.Cherry: return PointsForEatingCherry;
       default:
           throw new ArgumentOutOfRangeException("kind");
       }
 }
示例#2
0
        public void DoServerPoll_AsPacMan_EatApple_AddTheCorrectScorePerAppleType(AppleKind kind, int points)
        {
            var singleAppleLocation = new InitialApple { Lat = 2, Lon = 2, Type = kind };
            var instance = ServerFacadeFactory.CreateGameWithApplesOnlyAt(singleAppleLocation, new InitialApple{Lat=3, Lon=3} );

            instance.CreateGameX("GameName");
            var pacman = instance.JoinGameX("GameName", "PacManName", PlayerRole.PacMan);
            var earlyScore = instance.GetGameStateForX(pacman.PlayerId).Score;

            instance.UpdateMyWhereabouts(new ServerPollParameters(pacman.PlayerId, singleAppleLocation.Lat, singleAppleLocation.Lon, true));

            var currentScore = instance.GetGameStateAsObvserverX("GameName").Score;
            Assert.AreEqual(earlyScore + points, currentScore);
        }
示例#3
0
 public Apple(AppleKind kind)
 {
     this.Kind = kind;
 }