Esempio n. 1
0
        public void GetInt_Range_RandomInRangeResult()
        {
            var target = new BasicRandomization();

            FlowAssert.IsAtLeastOneAttemptOk(100, () => {
                Assert.AreEqual(0, target.GetInt(0, 2));
            });

            FlowAssert.IsAtLeastOneAttemptOk(100, () => {
                Assert.AreEqual(1, target.GetInt(0, 2));
            });

            for (int i = 0; i < 100; i++)
            {
                Assert.AreNotEqual(2, target.GetInt(0, 2));
            }
        }
        public void GetDouble_ManyThreads_DiffRandomResult()
        {
            var target = new BasicRandomization();
            var actual = new BlockingCollection <int>();

            Parallel.For(0, 1000, (i) =>
            {
                actual.Add(target.GetInt(0, int.MaxValue));
            });

            Assert.AreEqual(1000, actual.Count);
            Assert.AreEqual(1000, actual.Distinct().Count());
        }
Esempio n. 3
0
 public void Basic_GetInt()
 {
     _basic.GetInt(_min, _max);
 }