コード例 #1
0
        public void GenerateOneMillionString_WithRngProvider_ShouldBeUnique()
        {
            const int count  = 1000000;
            var       holder = new string[count];
            var       rnd    = new Random();

            using var rngProvider = new RNGCryptoServiceProvider();

            for (var i = 0; i < count; i++)
            {
                holder[i] = rngProvider.GetString(rnd.Next(10, 30));
            }

            holder.Should().NotBeEmpty().And.NotContainNulls().And.HaveCount(count).And.OnlyHaveUniqueItems();
        }