public void ShouldAddHighscoreToContextWhenAdding()
        {
            var highscore = new Highscore("Frank", Guid.NewGuid(), new QuestionResult());

            _objectUnderTest.AddHighscore(highscore);

            _chineseTrainerContextMock.Verify(p => p.Add(highscore));
        }
コード例 #2
0
        public void Initialize(Highscore currentHighscore)
        {
            CurrentHighscore = _scoreCalculator.CalculateScore(currentHighscore.QuestionResult);

            var allHighscores = _repository.GetAllHighscores(currentHighscore.DictionaryId);
            var highscoresForDictionary = GetOrderedHighscoresForDictionary(allHighscores, currentHighscore.DictionaryId);
            Highscores = GetBestAllTimeHighscores(highscoresForDictionary);
            PersonalBest = GetPersonalBest(highscoresForDictionary, currentHighscore.Username);
        }
コード例 #3
0
        public void Initialize()
        {
            _currentHighscore = CreateCurrentHighscore();

            var highscores = new List<Highscore>
                {
                    CreateHighscore("Frank", _testDictionary, 80),
                    CreateHighscore("Myself", _testDictionary, 50),
                    CreateHighscore("Sandra", _testDictionary, 40),
                    CreateHighscore("Sandra", _testDictionary, 70),
                    CreateHighscore("Myself", new Dictionary("dict2", null), 20),
                    _currentHighscore,
                    CreateHighscore("Frank", _testDictionary, 30),
                    CreateHighscore("Frank", _testDictionary, 60)
                };

            _repositoryMock = new Mock<IRepository>();
            _repositoryMock.Setup(p => p.GetAllHighscores(_testDictionary.Id)).Returns(highscores);

            _objectUnderTest = new HighscoreVM(_repositoryMock.Object, new ScoreCalculator());
        }
コード例 #4
0
 public void AddHighscore(Highscore highscore)
 {
     AddQuestionResult(highscore.QuestionResult);
     _chineseCharacterTrainerService.AddHighscore(highscore);
 }
コード例 #5
0
 private void RaiseUploadFinished(Highscore highScore)
 {
     var handler = UploadFinished;
     if (handler != null) handler(highScore);
 }
コード例 #6
0
 private void CompetitionSummaryVMUploadFinished(Highscore highscore)
 {
     _highscoreVM.Initialize(highscore);
     Content = _highscoreVM;
 }