public void GetSlugExtractsASlugOutOfLikelyTitles()
 {
     var slugPopulator = new SlugPopulator();
     Func<string, string> Try = slugPopulator.GetSlug;
     Assert.Equal("detail-id-equals-2190", Try("detail?id=2190"));
     Assert.Equal("func-percent-20-gnome", Try("func%20&nbsp;gnome"));
     Assert.Equal("c-sharp-rocks", Try("C# Rocks!"));
     Assert.Equal("using-di-or-dependency-injection", Try(HttpUtility.HtmlEncode("using DI/Dependency Injection")));
     Assert.Equal("using-di-or-dependency-injection", Try("using DI/Dependency Injection"));
 }
Exemple #2
0
 public OrderedPostPopulatorSet(
     SlugPopulator slug,
     TitleAndContentPopulator titleAndContent,
     MetaPopulator meta,
     PostValidator validator)
 {
     populators.Add(slug); //Slug first, this will be in the error message, if others throw.
     populators.Add(titleAndContent);
     populators.Add(meta);
     populators.Add(validator); //Validator last, to see if the read values, satisfy the ValidationAttributes
 }
 public OrderedPostPopulatorSet(
     SlugPopulator slug, 
     TitleAndContentPopulator titleAndContent, 
     MetaPopulator meta, 
     PostValidator validator)
 {
     populators.Add(slug); //Slug first, this will be in the error message, if others throw.
     populators.Add(titleAndContent);
     populators.Add(meta);
     populators.Add(validator); //Validator last, to see if the read values, satisfy the ValidationAttributes
 }