Пример #1
0
        public CreateGridTests()
        {
            _categoriesInitial = new List <string> {
                "Animal", "Colour", "Bird", "News", "Food", "Boat", "Plane", "Car", "Fruit"
            };
            _categoriesShuffled1 = new List <string> {
                "Food", "Fruit", "Colour", "Car", "Animal", "Plane", "Boat", "Bird", "News"
            };
            _categoriesShuffled2 = new List <string> {
                "Colour", "Fruit", "Boat", "Animal", "Plane", "Bird", "News", "Car", "Food"
            };

            _shuffleHelper = Substitute.For <IShuffleHelper <string> >();

            _shuffleHelper
            .ShuffleList(_categoriesShuffled1)
            .Returns(_categoriesShuffled1);

            _shuffleHelper
            .ShuffleList(_categoriesShuffled2)
            .Returns(_categoriesShuffled2);

            var scoreHelper = new ScoreHelper();

            _userThoughtsAndCrosses = new UserThoughtsAndCrosses(scoreHelper, _shuffleHelper);
        }
Пример #2
0
        public UncheckedWordTests()
        {
            _shuffleHelper     = Substitute.For <IShuffleHelper <string> >();
            _scoreHelper       = Substitute.For <IScoreHelper>();
            _categoriesInitial = new List <string> {
                "Animal", "Colour", "Bird", "News", "Food", "Boat", "Plane", "Car", "Fruit"
            };
            _categoriesShuffled = new List <string> {
                "Food", "Fruit", "Colour", "Car", "Animal", "Plane", "Boat", "Bird", "News"
            };

            _shuffleHelper = Substitute.For <IShuffleHelper <string> >();
            _shuffleHelper
            .ShuffleList(_categoriesInitial)
            .Returns(_categoriesShuffled);

            _userThoughtsAndCrosses = new UserThoughtsAndCrosses(_scoreHelper, _shuffleHelper);

            _userThoughtsAndCrosses.CreateGrid(_categoriesInitial);

            _userThoughtsAndCrosses.CheckWord("News");
            _userThoughtsAndCrosses.CheckWord("Food");
            _userThoughtsAndCrosses.CheckWord("Fruit");
            _userThoughtsAndCrosses.CheckWord("Bird");
            _userThoughtsAndCrosses.CheckWord("Car");
            _userThoughtsAndCrosses.CheckWord("Animal");
            _userThoughtsAndCrosses.CheckWord("Boat");
            _userThoughtsAndCrosses.CheckWord("Plane");
            _userThoughtsAndCrosses.CheckWord("Colour");
        }
Пример #3
0
        public void SetupNewThoughtsAndCrossesUser(string roomId, string userId, GameThoughtsAndCrosses game)
        {
            _joinRoomHelper.CreateRoom(userId, roomId);
            var userThoughtsAndCrosses = new UserThoughtsAndCrosses(_scoreHelper, _shuffleHelper);

            userThoughtsAndCrosses.CreateGrid(game.Topics.ChosenTopics);

            Rooms.RoomsList[roomId].Users[userId].SetUserThoughtsAndCrosses(userThoughtsAndCrosses);
        }
Пример #4
0
        public void ResetThoughtsAndCrosssesForUser(string roomId, string userId, GameThoughtsAndCrosses game)
        {
            var topics = Rooms.RoomsList[roomId].ThoughtsAndCrosses.Topics.ChosenTopics;

            Rooms.RoomsList[roomId].Users[userId].ThoughtsAndCrosses.CreateGrid(topics);
            var userThoughtsAndCrosses = new UserThoughtsAndCrosses(_scoreHelper, _shuffleHelper);

            userThoughtsAndCrosses.CreateGrid(game.Topics.ChosenTopics);

            Rooms.RoomsList[roomId].Users[userId].SetUserThoughtsAndCrosses(userThoughtsAndCrosses);
        }
Пример #5
0
        public void WhenCategoriesSelectedScoreShouldBeCalculatedCorrectly()
        {
            var scoreHelper = new ScoreHelper();

            var categories = new List <string> {
                "Animal", "Colour", "Bird", "News", "Food", "Boat", "Plane", "Car", "Fruit"
            };

            _shuffleHelper = Substitute.For <IShuffleHelper <string> >();
            _shuffleHelper
            .ShuffleList(categories)
            .Returns(categories);

            var userThoughtsAndCrosses = new UserThoughtsAndCrosses(scoreHelper, _shuffleHelper);

            userThoughtsAndCrosses.CreateGrid(categories);
            userThoughtsAndCrosses.CalculateScore();
            var initialScore = userThoughtsAndCrosses.Score;

            userThoughtsAndCrosses.CheckWord("Animal");
            userThoughtsAndCrosses.CheckWord("Bird");
            userThoughtsAndCrosses.CheckWord("Food");
            userThoughtsAndCrosses.CheckWord("Plane");
            userThoughtsAndCrosses.CheckWord("Fruit");

            userThoughtsAndCrosses.CalculateScore();
            var finalScore = userThoughtsAndCrosses.Score;

            initialScore
            .Should()
            .Be(0);

            finalScore
            .Should()
            .Be(11);
        }