Пример #1
0
        public void TestCircleOfLife()
        {
            var service = new MastermindService();
            var guid    = service.CreateNewGame();
            var game    = service.GetGame(guid);
            var game2   = service.GetGame(guid);

            Assert.AreEqual(game, game2);

            service.QuitGame(guid);
            var game3 = service.GetGame(guid);

            Assert.IsNull(game3);
        }
Пример #2
0
        public Score NextTry(Guid guid, Colour[] colours)
        {
            if (colours.Length != 4)
            {
                throw new Exception("row must have 4 pins");
            }
            var row  = new Row(colours[0], colours[1], colours[2], colours[3]);
            var game = service.GetGame(guid);

            if (game != null)
            {
                return(game.PlayRow(row));
            }
            throw new Exception("guid doesn't exist");
        }