예제 #1
0
        public void Assert_GetHighscores_is_correct(int expected, int count)
        {
            ActionResult     result     = highscoresController.GetHighscores(count);
            var              okResult   = result as OkObjectResult;
            List <Highscore> highscores = okResult.Value as List <Highscore>;

            Assert.AreEqual(expected, highscores.Count);
        }
        public async void AddHighscore()
        {
            Highscore highscore = new Highscore();

            highscore.User  = "******";
            highscore.Score = 120;

            await _controller.PostHighscore(highscore);

            Assert.NotEmpty(_context.HighScores);

            _context.HighScores.RemoveRange(_controller.GetHighscores());
            await _context.SaveChangesAsync();
        }
예제 #3
0
    void Awake()
    {
        entryContainer = transform.Find("HighscoreEntryContainer");
        entryTemplate  = entryContainer.Find("HighscoreEntryTemplate");

        entryTemplate.gameObject.SetActive(false);

        highscoreEntryTransformList = new List <Transform>();
        foreach (HighscoreEntry highscoreEntry in highscoresController.GetHighscores().highscoreEntries)
        {
            CreateHighscoreEntryTransform(highscoreEntry, entryContainer, highscoreEntryTransformList);
        }
    }
예제 #4
0
        public async void NewHighestHighscore()
        {
            dataContext.Highscores.RemoveRange((await controller.GetHighscores()).Value);
            await dataContext.SaveChangesAsync();

            Highscore highscore;

            for (var i = 1; i < 12; i++)
            {
                highscore          = new Highscore();
                highscore.Score    = 100 * i;
                highscore.Initials = "AS" + i;
                await controller.AddHighscore(highscore);
            }
            highscore          = new Highscore();
            highscore.Score    = 999999;
            highscore.Initials = "ASD";
            await controller.AddHighscore(highscore);

            var highscores = await controller.GetHighscores();

            Assert.Equal(highscore.Score, (await controller.GetHighscores()).Value.ElementAt(0).Score);
            dataContext.Highscores.RemoveRange((await controller.GetHighscores()).Value);
            await dataContext.SaveChangesAsync();
        }