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); }
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"); }
public TopicManager(IShuffleHelper <string> shuffleHelper) { _shuffleHelper = shuffleHelper; InitialTopics = new List <string> { "Boys name", "Girls name", "Hobby", "Fictional character", "Something outside", "Book", "Electrical item", "Kitchen item", "Body part", "Song", "Something savoury", "Something sweet", "Colour", "Toy", "Movie", "Job / Occupation", "Sport / Game", "Place", "Food", "TV programme", "Transport", "Pet", "Actor / Actress", "Family member", "Holiday destination", "Weather", "Animal / Bird", "Something you make", "Drink", "Ice cream", "Artist", "Company / Brand", "Musical instrument", "Fundraising Activity" }; InitialTopics = _shuffleHelper.ShuffleList(InitialTopics); }
public LetterManager(IShuffleHelper <string> shuffleHelper) { _shuffleHelper = shuffleHelper; Alphabet = new List <string> { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "XYZ" }; Alphabet = _shuffleHelper.ShuffleList(Alphabet); }
// ToDo: allow selection by category public void ChooseWord() { if (WordsUsed == WordsWithCategories.Count) { _shuffleWordDataHelper.ShuffleList(WordsWithCategories); WordsUsed = 0; } Word = WordsWithCategories[WordsUsed]; WordsUsed++; }
public void ChooseActivePlayer() { if (PlayerTurns == Players.Count) { _shuffleStringHelper.ShuffleList(Players); PlayerTurns = 0; } ActivePlayer = Players[PlayerTurns]; PlayerTurns++; }
public void SetLetter() { if (Alphabet.Count <= NumLettersUsed) { NumLettersUsed = 0; Alphabet = _shuffleHelper.ShuffleList(Alphabet); } Letter = Alphabet[NumLettersUsed]; NumLettersUsed++; }
public void WhenLetterSetIsCalledLetterShouldHaveAValue() { _shuffleHelper .ShuffleList(Arg.Any <List <string> >()) .Returns(new List <string> { "B", "A", "D", "C", "XYZ", "W", "V", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "G", "F", "E" }); var thoughtsAndCrosses = new GameThoughtsAndCrosses(_shuffleHelper); thoughtsAndCrosses.SetLetter(); var letter1 = thoughtsAndCrosses.Letter.Letter; thoughtsAndCrosses.SetLetter(); var letter2 = thoughtsAndCrosses.Letter.Letter; thoughtsAndCrosses .Letter .Letter .Should() .NotBeNullOrWhiteSpace(); letter1.Should().NotBeEquivalentTo(letter2); }
public void SetChosenTopics() { if (NumTopicsUsed + 9 > InitialTopics.Count) { InitialTopics = _shuffleHelper.ShuffleList(InitialTopics); NumTopicsUsed = 0; } var nineTopics = new List <string>(); for (var i = 0; i < 9; i++) { nineTopics.Add(InitialTopics[NumTopicsUsed + i]); } ChosenTopics = nineTopics; NumTopicsUsed += 9; }
public PixenaryManager(IShuffleHelper <string> shuffleStringHelper, IShuffleHelper <WordData> shuffleWordDataHelper, IWordCategoryHelper wordCategoryHelper, string roomId) { _shuffleStringHelper = shuffleStringHelper; _wordCategoryHelper = wordCategoryHelper; _shuffleWordDataHelper = shuffleWordDataHelper; Players = new List <string>(); Grid = new List <string>(); WordsWithCategories = _wordCategoryHelper.GetAllWordsWithCategories(); _shuffleWordDataHelper.ShuffleList(WordsWithCategories); var users = Rooms.RoomsList[roomId].Users; foreach (var player in users) { Players.Add(player.Key); } _shuffleStringHelper.ShuffleList(Players); }
public void WhenPassedAListOfCategoriesAGridShouldBeCreated() { _shuffleHelper .ShuffleList(_categoriesInitial) .Returns(_categoriesShuffled1); _userThoughtsAndCrosses.CreateGrid(_categoriesInitial); _userThoughtsAndCrosses.WordsGrid.Should().BeEquivalentTo(new List <(string category, string userGuess, bool isAccepted)> { (_categoriesShuffled1[0], "", false), (_categoriesShuffled1[1], "", false), (_categoriesShuffled1[2], "", false), (_categoriesShuffled1[3], "", false), (_categoriesShuffled1[4], "", false), (_categoriesShuffled1[5], "", false), (_categoriesShuffled1[6], "", false), (_categoriesShuffled1[7], "", false), (_categoriesShuffled1[8], "", false), }); }
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); }