public void SentenceWordCanSpecifyPossibleFollowingWords()
        {
            // ARRANGE
            var word = new SentenceWord(DefaultWord);

            // ACT
            word.AddPossibleFollowingWord(PossibleNextWordA);
            word.AddPossibleFollowingWord(PossibleNextWordB);

            // ASSERT
            Assert.IsTrue(word.GetPossibleFollowingWords().Contains(PossibleNextWordA));
            Assert.IsTrue(word.GetPossibleFollowingWords().Contains(PossibleNextWordB));
        }
Exemplo n.º 2
0
        private static bool EndSentence(SentenceWord currentWord)
        {
            var random         = new Random(DateTime.Now.Millisecond);
            var canEndSentence = currentWord.CanEndSentence;

            canEndSentence = canEndSentence && random.Next(0, currentWord.GetPossibleFollowingWords().Count() + 1) == 0;

            return(canEndSentence);
        }
        public void WithSentenceWordWithNextFollowingWord_WhenAddingSameFollowingWord_OnlyOneCopyOfWordIsContained()
        {
            // ARRANGE
            var word = new SentenceWord(DefaultWord);

            // ACT
            word.AddPossibleFollowingWord(PossibleNextWordA);
            word.AddPossibleFollowingWord(PossibleNextWordA);

            // ASSERT
            Assert.AreEqual(1, word.GetPossibleFollowingWords().Count(w => w == PossibleNextWordA));
        }