Esempio n. 1
0
        public void ConsecutiveGeneratedNamesAreUnique()
        {
            var Namer = new name_on_core.Namer();
            var name1 = Namer.Gen();
            var name2 = Namer.Gen();

            Assert.AreNotEqual(name1, name2);
        }
Esempio n. 2
0
        public void NamesAreStringDashStringDashNumber()
        {
            var Namer   = new name_on_core.Namer();
            var name1   = Namer.Gen();
            var pattern = @"^[a-zA-Z]+-[a-zA-Z]+-\d+$";
            var r       = new Regex(pattern);

            Assert.IsTrue(r.IsMatch(name1), $"Wrong Pattern: {name1} doesn't match {pattern}");
        }
Esempio n. 3
0
        public void NamesAreVeryUnique()
        {
            var n   = new name_on_core.Namer();
            var max = 1000000;
            var d   = new Dictionary <string, int>();

            for (var i = 0; i < max; i++)
            {
                var name = n.Gen();
                try {
                    d.Add(name, 0);
                }catch (System.ArgumentException) {
                    Debug.WriteLine(name);
                }
            }
        }