public void ShouldGenerateAnIdWithExpectedWordCountByDefault() { var id = GfycatesceIds.Generate(); var words = SplitCamelCase(id); Assert.AreEqual(words.Count(), GfycatesceIds.DefaultPattern.Length); }
public void ShouldGenerateAnIdWithCustomFormat(WordType[] pattern) { var id = GfycatesceIds.Generate(pattern); var words = SplitCamelCase(id); for (var i = 0; i < pattern.Length; i++) { Assert.IsTrue(Words.WordIsInWordList(words[i], pattern[i])); } }
public void ShouldGenerateAnIdWithGfycatFormat() { var id = GfycatesceIds.Generate(GfycatesceIds.GfycatPattern); var words = SplitCamelCase(id); for (var i = 0; i < GfycatesceIds.GfycatPattern.Length; i++) { Assert.IsTrue(Words.WordIsInWordList(words[i], GfycatesceIds.GfycatPattern[i])); } }
static string GenerateIdAndCheckForDupes(ICollection <string> hashSet) { var id = GfycatesceIds.Generate(); if (hashSet.Contains(id)) { id = GenerateIdAndCheckForDupes(hashSet); } return(id); }
static void Main(string[] args) { Console.WriteLine(GfycatesceIds.Generate(GfycatesceIds.GfycatPattern)); var id = GfycatesceIds.Generate(new[] { WordType.Adjective, WordType.Verb, WordType.Verb, WordType.Animal }); Console.WriteLine(id); for (int i = 0; i < 100; i++) { Console.WriteLine(GfycatesceIds.Generate()); } Console.ReadLine(); }
public void ShouldGenerateAnId() { var id = GfycatesceIds.Generate(); Assert.IsNotEmpty(id); }