protected TagWithWord CreateTagWithWord(Tag tag, IWordProvider wordProvider)
 {
     return
         (new TagWithWord(
              formatString: (wordToFormat, tagString) => _stringFormatter.FormatString(wordToFormat, tagString),
              tag: tag,
              word:
              tag.HasIdentifer
                                                 ? CreateWordFromIdentifiedTag(tag)
                                                 : wordProvider.GetNewWord(tag)));
 }
示例#2
0
        public List <PalindromeResult> FindPalindromes(string input, int max)
        {
            List <PalindromeResult> result = new List <PalindromeResult>();

            // only allows alphabets and numbers and remove case sensitivity
            input = stringFormatter.FormatString(input);

            //continue only if the input fits the basic requirement to be a palindrome
            //and if the max number of longest unique palindromes is more than zero
            if (input.Length > 1 && max > 0)
            {
                //Search for palindrome begins from the longest possible length
                result = SearchAlgorithm(input, max, result);
            }

            return(result);
        }
示例#3
0
        public void GIVEN_empty_string_WHEN_CleanString_is_called_THEN_should_return_empty_string()
        {
            //Arrange
            var input = "";

            //Act
            var response = formatter.FormatString(input);

            //Assert
            Assert.AreEqual(input, response);
        }