public void LinesAreAddedToModelOnLearn() { var model = new StringMarkov(); model.Learn(ExampleData); Assert.AreEqual(ExampleData.Count(), model.SourceLines.Count); CollectionAssert.AreEquivalent(ExampleData, model.SourceLines); }
public void LearningDuplicateLinesAreIgnored() { var model = new StringMarkov(); model.Learn(ExampleData); model.Learn(ExampleData); Assert.AreEqual(ExampleData.Count(), model.SourcePhrases.Count); Assert.That(ExampleData.ToList(), Is.EquivalentTo(model.SourcePhrases)); Assert.That(model.SourcePhrases, Is.Unique); }
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); }