コード例 #1
0
        public void ShouldGenerateAnIdWithExpectedWordCountByDefault()
        {
            var id    = GfycatesceIds.Generate();
            var words = SplitCamelCase(id);

            Assert.AreEqual(words.Count(), GfycatesceIds.DefaultPattern.Length);
        }
コード例 #2
0
        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]));
            }
        }
コード例 #3
0
        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]));
            }
        }
コード例 #4
0
            static string GenerateIdAndCheckForDupes(ICollection <string> hashSet)
            {
                var id = GfycatesceIds.Generate();

                if (hashSet.Contains(id))
                {
                    id = GenerateIdAndCheckForDupes(hashSet);
                }

                return(id);
            }
コード例 #5
0
        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();
        }
コード例 #6
0
        public void ShouldGenerateAnId()
        {
            var id = GfycatesceIds.Generate();

            Assert.IsNotEmpty(id);
        }