public void Execute(int wight, int height, int minWordsForGrid) { List<Word> wordsForGame = words.GetAll(); Grid<char> grid = new Grid<char>((uint)wight, (uint)height); GridWithLetters gridWithLetters; wordsForGame = shuffleWordsService.Shuffle(wordsForGame); if (minWordsForGrid < wordsForGame.Count) { int toremover = wordsForGame.Count - minWordsForGrid; wordsForGame.RemoveRange(minWordsForGrid, toremover); } gridWithLetters = addWordsService.AddWords(grid, wordsForGame); gridWithLetters = fillGridService.FillGrid(gridWithLetters); gameService.SetNewGame(gridWithLetters); if (haveGameActive) OnGameReset?.Invoke(); Logger.Log("-- New Game --"); haveGameActive = true; }
public void FillGridServiceShouldSimplePasses() { // Given GridWithLetters dataGrid = new GridWithLetters(new Grid <char>(3, 3), new Dictionary <Word, List <Position> >()); // When var result = fillGridService.FillGrid(dataGrid); // Then Assert.IsTrue(CheckEmptySpaces.Check(result)); }