Exemplo n.º 1
0
 public void CreateNewHighScore()
 {
     string username = "******";
     Score highScore = new Score(username, 4);
     DateTime dateTime = highScore.GetPlayerScoreDate();
     Assert.AreEqual(string.Format("{0} {1} {2}", username, highScore.GetPlayerMoves(), highScore.GetPlayerScoreDate()), highScore.ToString());
 }
Exemplo n.º 2
0
        public void insertHighScore(int ScorePlayerID, Score score)
        {
            using (var context = new CheckersDatabaseContainer())
            {
                var query = from Player in context.Players where Player.PlayerID == ScorePlayerID select Player;

                foreach (var result in query)
                {
                    var player = result;
                    var highScore = new HighScores()
                    {
                        Player = player,
                        PlayerID = ScorePlayerID,
                        PlayerMoves = score.GetPlayerMoves(),
                        PlayerScoreDate = score.GetPlayerScoreDate()
                    };
                    context.HighScores.Add(highScore);
                }
                context.SaveChanges();                
            }
        }