コード例 #1
0
        public void CountHyphensWhenThereAreOnlySpaces()
        {
            var sentence = "my sentence    is only           spaces";

            var calculator   = new HyphensCalculator();
            var countHyphens = calculator.Count(sentence);

            Assert.AreEqual((uint)4, countHyphens);
        }
コード例 #2
0
        public void GetStatistics_WithoutHyphens_ReturnCorrectCounting(string textQuery, int expectingWords)
        {
            //Arrange
            ICountingStatisticCalculator hyphensCalculator = new HyphensCalculator();

            //Action
            ITextCountingStatistic result = hyphensCalculator.GetStatistics(textQuery);

            //Assert
            Assert.True(result.GetCount() == expectingWords);
        }
コード例 #3
0
ファイル: Textor.svc.cs プロジェクト: Bhaal22/textor
        public TextStatistics Statistics(string text)
        {
            if (text == null)
            {
                throw new ArgumentNullException("Input text is null.");
            }

            var hyphensCalculator = new HyphensCalculator();
            var wordsCalculator   = new WordsCalculator();
            var spacesCalculator  = new SpacesCalculator();


            return(new TextStatistics()
            {
                HyphensCount = hyphensCalculator.Count(text),
                SpacesCount = spacesCalculator.Count(text),
                WordsCount = wordsCalculator.Count(text)
            });
        }