public void Generate_New_Game() { // Given wordsRepository.Add(new Word("Uno")); wordsRepository.Add(new Word("Dos")); wordsRepository.Add(new Word("Tres")); wordsRepository.Add(new Word("Cuatro")); wordsRepository.Add(new Word("Cinco")); ramdomPositionGenerator.SetMaxPosition(new Position(10, 10)); ramdomPositionGenerator.SetReturnPosition(new Position(0, 0)); ramdomPositionGenerator.SetReturnPosition(new Position(1, 1)); ramdomPositionGenerator.SetReturnPosition(new Position(2, 2)); ramdomPositionGenerator.SetReturnPosition(new Position(3, 3)); ramdomPositionGenerator.SetReturnPosition(new Position(4, 4)); // When action.Execute(9, 9, 5); // Then var result = gameService.Grid; PrintGrid.Print(result); Assert.IsTrue(result.GetLeterInPosition(0, 0) == 'U'); Assert.IsTrue(result.GetLeterInPosition(1, 0) == 'n'); Assert.IsTrue(result.GetLeterInPosition(2, 0) == 'o'); Assert.IsTrue(result.GetLeterInPosition(1, 1) == 'D'); Assert.IsTrue(result.GetLeterInPosition(2, 1) == 'o'); Assert.IsTrue(result.GetLeterInPosition(3, 1) == 's'); Assert.IsTrue(result.GetLeterInPosition(2, 2) == 'T'); Assert.IsTrue(result.GetLeterInPosition(3, 2) == 'r'); Assert.IsTrue(result.GetLeterInPosition(4, 2) == 'e'); Assert.IsTrue(result.GetLeterInPosition(5, 2) == 's'); Assert.IsTrue(result.GetLeterInPosition(3, 3) == 'C'); Assert.IsTrue(result.GetLeterInPosition(4, 3) == 'u'); Assert.IsTrue(result.GetLeterInPosition(5, 3) == 'a'); Assert.IsTrue(result.GetLeterInPosition(6, 3) == 't'); Assert.IsTrue(result.GetLeterInPosition(7, 3) == 'r'); Assert.IsTrue(result.GetLeterInPosition(8, 3) == 'o'); Assert.IsTrue(result.GetLeterInPosition(4, 4) == 'C'); Assert.IsTrue(result.GetLeterInPosition(5, 4) == 'i'); Assert.IsTrue(result.GetLeterInPosition(6, 4) == 'n'); Assert.IsTrue(result.GetLeterInPosition(7, 4) == 'c'); Assert.IsTrue(result.GetLeterInPosition(8, 4) == 'o'); Assert.IsTrue(CheckEmptySpaces.Check(result)); Assert.IsTrue(ramdomPositionGenerator.Count == 0); }
public void Add_Word_Successfully_In_Zero_Position() { // Given var grid = new Grid <char>(10, 10); wordsRepository.Add(new Word("Uno")); ramdomPositionGenerator.SetMaxPosition(new Position(10, 10)); ramdomPositionGenerator.SetReturnPosition(new Position(0, 0)); // When var result = addWordsService.AddWords(grid, wordsRepository.GetAll()); // Then PrintGrid.Print(result); Assert.IsTrue(result.GetLeterInPosition(0, 0) == 'U'); Assert.IsTrue(result.GetLeterInPosition(1, 0) == 'n'); Assert.IsTrue(result.GetLeterInPosition(2, 0) == 'o'); }
public void Repositioning_Word_Wiht_New_Position_When_Word_Do_Not_Fit_In_Grid() { // Given var grid = new Grid <char>(10, 10); wordsRepository.Add(new Word("Uno")); ramdomPositionGenerator.SetMaxPosition(new Position(10, 10)); ramdomPositionGenerator.SetReturnPosition(new Position(8, 5)); // When var result = addWordsService.AddWords(grid, wordsRepository.GetAll()); // Then PrintGrid.Print(result); Assert.IsTrue(result.GetLeterInPosition(0, 6) == 'U'); Assert.IsTrue(result.GetLeterInPosition(1, 6) == 'n'); Assert.IsTrue(result.GetLeterInPosition(2, 6) == 'o'); Assert.IsTrue(ramdomPositionGenerator.Count == 0); }