public void CountWords_NullPassed_CatchesException()
        {
            var wordsCounter = new ClassicCounterLogic();
            var properDict = new Dictionary<string, int>();

            var result = wordsCounter.CountWordsInSentence(null);

            Assert.IsFalse(result.Any());
        }
        public void CountWords_EmptySentences_CountsWordCorrectly()
        {
            var wordsCounter = new ClassicCounterLogic();
            var properDict = new Dictionary<string, int>();

            var result = wordsCounter.CountWordsInSentence(string.Empty);

            Assert.IsTrue(properDict.All(e => result.Contains(e)));
        }
        public void SentenceUtil_CountWord_ReturnStringWithOutNewLines()
        {
            var classicCounterLogic = new ClassicCounterLogic();
            var expectedString = "this - 2is - 2a - 1sentence - 1so - 1";
            var senteceUtil = new SentenceUtil(classicCounterLogic, "{0} - {1}", false);

            var computedString = senteceUtil.CountWords("This is a sentence, so is this.");

            Assert.IsTrue(expectedString.Equals(computedString));
        }
        public void SentenceUtil_CountWord_ReturnInvertedStringWithOutNewLines()
        {
            var classicCounterLogic = new ClassicCounterLogic();
            var expectedString = "2 - this2 - is1 - a1 - sentence1 - so";
            var senteceUtil = new SentenceUtil(classicCounterLogic, "{1} - {0}", false);

            var computedString = senteceUtil.CountWords("This is a sentence, so is this.");

            Assert.IsTrue(expectedString.Equals(computedString));
        }
        public void SentenceUtil_Constructor_CreatesCorrectObject()
        {
            var classicCounterLogic = new ClassicCounterLogic();

            var senteceUtil = new SentenceUtil(classicCounterLogic, "{0} - {1}");

            Assert.IsNotNull(senteceUtil);

            senteceUtil = null;
        }
        public void CountWords_IncorrectSentencePassed_CountsWordCorrectly()
        {
            var wordsCounter = new ClassicCounterLogic();
            var properDict = new Dictionary<string, int>
            {
                { "this", 2 },
                { "is", 2 },
                { "a", 1 },
                { "sentence", 1 },
                { "so", 1 }
            };

            var result = wordsCounter.CountWordsInSentence("This a different sentence, so is this.");

            Assert.IsFalse(properDict.All(e => result.Contains(e)));
        }