static void Main(string[] args) { var combinationLength = 6; var inputTxt = "input.txt"; var reader = new DistinctInputWordsRepository( new IO.InputWordsFromTxtFileRepository( new InputWordsFromTxtFileConfiguration(inputTxt))); var inputWords = reader.GetAll(); var combiner = new WordCombinationTupleWithExactResultingWordLenthAndAlsoInInputFinder(combinationLength); var result = combiner.FindAllCombinations(inputWords.ToList()); foreach (var word in result) { Console.WriteLine(word); } Console.WriteLine(); Console.WriteLine($"Found {result.Count} unique word combinations of length {combinationLength}"); if (System.Diagnostics.Debugger.IsAttached) { Console.ReadKey(); } }
public void Can_read_all_distinct_words_from_file() { var sut = new DistinctInputWordsRepository( new InputWordsFromTxtFileRepository( new InputWordsFromTxtFileConfiguration("input.txt"))); var words = sut.GetAll(); Assert.Equal(1421, words.Length); }
public void Can_read_all_distinct_words() { var wordsProvider = Substitute.For <IInputWordsRepository>(); var returnThis = new[] { "abc", "def", "abc", "ghi" }.Select(x => new InputWord(x)).ToArray(); wordsProvider.GetAll().Returns(returnThis); var sut = new DistinctInputWordsRepository(wordsProvider); Assert.Equal(3, sut.GetAll().Length); }