예제 #1
0
        public void CanLearnLinesWithTrainedModel()
        {
            var model = new StringMarkov();

            model.Learn(ExampleData);

            Assert.AreEqual(ExampleData.Count(s => s.Split(' ').Length > model.Level), model.SourceLines.Count);
            CollectionAssert.AreEquivalent(ExampleData.Where(s => s.Split(' ').Length > model.Level), model.SourceLines);

            model.Learn("I do not like green eggs and hams");
            Assert.AreEqual(ExampleData.Count() + 1, model.SourceLines.Count);
        }