Esempio n. 1
0
        public void TestCelebGuessedGoesToCorrectState()
        {
            Celeb celeb = new Celeb("Danny Dyer");

            celeb.Guess();
            celeb.State.Should().Be(CelebState.GUESSED);
        }
Esempio n. 2
0
        public void TestCelebGuessedWhenStateInvalid()
        {
            Celeb celeb = new Celeb("Danny Dyer");

            celeb.Guess();
            celeb.Invoking(c => c.Guess())
            .Should().Throw <InvalidOperationException>();
        }
Esempio n. 3
0
        public void CelebGuessed(int celebId)
        {
            Celeb celeb = _context.Celeb.Single(c => c.Id == celebId);

            celeb.Guess();
            _context.Celeb.Update(celeb);
            _context.SaveChanges();
        }
Esempio n. 4
0
        public void TestGameStateCelebGuessedGame()
        {
            Game game   = new Game();
            var  geezer = new Celeb("Danny Dyer");

            game.AddCeleb(geezer);
            game.AddCeleb(new Celeb("Geoff Capes"));
            game.State.Should().Be(RoundState.ROUND_READY_TO_START);
            geezer.Guess();
            game.State.Should().Be(RoundState.ROUND_IN_PROGRESS);
        }
Esempio n. 5
0
        public void TestGameStateAllCelebsGuessedGame()
        {
            Game game   = new Game();
            var  geezer = new Celeb("Danny Dyer");

            game.AddCeleb(geezer);
            var geoff = new Celeb("Geoff Capes");

            game.AddCeleb(geoff);
            game.State.Should().Be(RoundState.ROUND_READY_TO_START);
            geezer.Guess();
            geoff.Guess();
            game.State.Should().Be(RoundState.ROUND_COMPLETE);
        }
Esempio n. 6
0
        public void TestGetNullBackIfNoneInHat()
        {
            Game game = new Game();

            var geezer = new Celeb("Danny Dyer");

            game.AddCeleb(geezer);

            var geoff = new Celeb("Geoff Capes");

            game.AddCeleb(geoff);

            geezer.Guess();
            geoff.Burn();

            game.GetRandomCelebFromHat().Should().BeNull();
        }
Esempio n. 7
0
        public void TestGetRandomCeleb()
        {
            Game game   = new Game();
            var  geezer = new Celeb("Danny Dyer");

            game.AddCeleb(geezer);
            var geoff = new Celeb("Geoff Capes");

            game.AddCeleb(geoff);
            var john = new Celeb("John Peel");

            game.AddCeleb(john);
            var bill = new Celeb("Bill Bailey");

            game.AddCeleb(bill);
            var jake = new Celeb("Jake Gyllenhaal");

            game.AddCeleb(jake);
            geezer.Guess();
            geoff.Guess();
            john.Guess();
            jake.Guess();
            game.GetRandomCelebFromHat().Should().Be(bill);
        }
Esempio n. 8
0
        public void TestCelebGuessed()
        {
            Game  newGame = GameAPI.CreateGame("New Game");
            Celeb celeb   = GameAPI.AddCelebToGame(new Celeb()
            {
                Name = "Name 1", GameId = newGame.Id
            }, newGame);
            Celeb celeb2 = GameAPI.AddCelebToGame(new Celeb()
            {
                Name = "Name 2", GameId = newGame.Id
            }, newGame);
            Celeb celeb3 = GameAPI.AddCelebToGame(new Celeb()
            {
                Name = "Name 3", GameId = newGame.Id
            }, newGame);

            celeb2.Guess();

            GameAPI.UpdateCeleb(celeb2);

            Celeb retrievedCeleb = GameAPI.GetCeleb(celeb2.Id);

            retrievedCeleb.State.Should().Be(CelebState.GUESSED);
        }