Exemplo n.º 1
0
        private void AssertSingleResultOfGetRandomGreaterThanTwoLessThanN(
            int n, List <int> exclusions, int expected)
        {
            var randomNumberHelper = new RandomNumberHelper();
            var result             = randomNumberHelper.GetRandomGreaterThanTwoLessThanN(n, exclusions);

            Assert.Equal(expected, result);
        }
Exemplo n.º 2
0
        public void GetRandomReturnsOnlyValidValue()
        {
            var       randomNumberHelper = new RandomNumberHelper();
            const int n      = 3;
            var       result = randomNumberHelper.GetRandomGreaterThanTwoLessThanN(n);

            Assert.Equal(2, result);
        }
Exemplo n.º 3
0
        public void GetRandomLessThanReturnsIntegerLessThanN()
        {
            var       randomNumberHelper = new RandomNumberHelper();
            const int n      = 15;
            var       result = randomNumberHelper.GetRandomGreaterThanTwoLessThanN(n);

            Assert.True(result > 1);
            Assert.True(result < 15);
        }
Exemplo n.º 4
0
        public void GetRandomGreaterThanTwoLessThanNReturnsAValidValue()
        {
            var        n          = 8;
            List <int> exclusions = new List <int> {
                3, 5, 6
            };
            var        randomNumberHelper = new RandomNumberHelper();
            var        result             = randomNumberHelper.GetRandomGreaterThanTwoLessThanN(n, exclusions);
            List <int> possibleResults    = new List <int> {
                2, 4, 7
            };

            Assert.Contains(result, possibleResults);
        }