Exemple #1
0
        public void WhenGenerateAKeyOneTime_ThenRandomUniqueKeyIsGenerated()
        {
            var generator = new UrlKeyGenerator();
            var key       = generator.Generate();

            key.Length.Should().Be(ExpectedKeyLength);
        }
Exemple #2
0
        public void WhenGenerateAKeyMultipleTimes_ThenRandomUniqueKeysAreGenerated()
        {
            var generator = new UrlKeyGenerator();
            var keyList   = new List <string>();

            for (int i = 0; i < 10000; i++)
            {
                var key = generator.Generate();
                keyList.Should().NotContain(key);
                keyList.Add(key);
            }
        }