public void Execute(Settlement settlement) { var nameGroup = gateway.All(); var names = nameGroup.SelectMany(x => x.Names); var gen = new MarkovNameGenerator(names, Order); settlement.Name = gen.Generate(MaximumLength); }
public void ShouldBuildAStringBasedOnValuesNotToExceedASpecifiedLength() { var names = new string[] { "Alpha", "Bravo", "Charlie", "Delta" }; var gen = new MarkovNameGenerator(names, 1); var name = gen.Generate(6); Assert.True(name.Length <= 6); }
public void OrderCanBeIncreasedToProvideMoreConsistencyOfTokens() { /* * Given abacad with an order of 2 * Then we should generate tokens like * __ => a, _a => b, ab => a, ba => c, ac => a, ca => d, ad */ var names = new string[] { "abacad" }; var gen = new MarkovNameGenerator(names, 2); var tok = gen.States.First(x => x.Key == "ab"); Assert.NotNull(tok); Assert.Equal("a", tok.Tokens.Keys.First()); //With this model, the only valid generation is the input string Assert.Equal("Abacad", gen.Generate(6)); }