示例#1
0
        public void GeneratesRandomBool()
        {
            for (int i = 0; i < new Random().Next(5, 20); i++)
            {
                bool v1 = RandomUtilities.GetRandomBoolean();
                bool v2 = RandomUtilities.GetRandomBoolean(v1);
                Assert.AreNotEqual(v1, v2);

                v1 = RandomUtilities.GetRandom <bool>();
                Assert.IsInstanceOfType(v1, typeof(bool));

                v2 = RandomUtilities.GetRandom(v1);
                Assert.IsInstanceOfType(v2, typeof(bool));
                Assert.AreNotEqual(v1, v2);

                v1 = RandomUtilities.GetRandom(typeof(bool));
                Assert.IsInstanceOfType(v1, typeof(bool));

                v2 = RandomUtilities.GetRandom(typeof(bool), v1);
                Assert.IsInstanceOfType(v2, typeof(bool));
                Assert.AreNotEqual(v1, v2);
            }
        }