コード例 #1
0
        public void Create()
        {
            var cache = A.Fake<ICache>();
            var settings = new Dictionary<string, string> {
                { Keys.Contains, string.Empty },
                { Keys.Length, "3" },
            };

            var obj = new RandomStringProvider(cache, settings);

            Assert.IsNotNull(obj);
        }
コード例 #2
0
        public void GetOnlyUpper()
        {
            var cache = A.Fake<ICache>();
            var settings = new Dictionary<string, string> {
                { Keys.Contains, Keys.UpperLetters },
                { Keys.Length, "3" },
            };

            var obj = new RandomStringProvider(cache, settings);

            var result = obj.GetAll();
            var j = 9;
            foreach (var t in result)
            {
                Assert.True((string)t[0] == ((string)t[0]).ToUpper(CultureInfo.InvariantCulture));
                if (j-- == 0) break;
            }
        }
コード例 #3
0
        public void GetOnlyNumbers()
        {
            var cache = A.Fake<ICache>();
            var settings = new Dictionary<string, string> {
                { Keys.Contains, Keys.Numbers },
                { Keys.Length, "3" },
            };

            var obj = new RandomStringProvider(cache, settings);

            var result = obj.GetAll();
            var j = 9;
            foreach (var t in result)
            {
                for (var i = 0; i < 3; i++)
                {
                    Assert.DoesNotThrow(() => Convert.ToInt32(((string)t[0])[i]));
                }
                if (j-- == 0) break;
            }
        }