示例#1
0
        public void RandomNumberGeneratorReturnsEmptyStringWhenAllNumbersAreCalled()
        {
            var sut = new BingoCaller(new Random());

            for (var i = 1; i <= 75; i++)
            {
                sut.GetNumber();
            }

            Assert.AreEqual("", sut.GetNumber());
        }
示例#2
0
        public void BingoCallerReturnsCorrectString(int number, string expected)
        {
            var sut    = new BingoCaller(new FakeRandom(number));
            var actual = sut.GetNumber();

            Assert.AreEqual(expected, actual);
        }
示例#3
0
        public void RandomNumberGeneratorReturnsAllNumbersOnlyOnce()
        {
            var list = new List <string>();
            var sut  = new BingoCaller(new Random());

            for (var i = 1; i <= 75; i++)
            {
                list.Add(sut.GetNumber());
            }

            Assert.AreEqual(list.Count, list.Distinct().Count());
        }
示例#4
0
        public void EachNumberIsBetween1And75()
        {
            var caller = new BingoCaller(new Random());

            for (var i = 1; i <= 75; i++)
            {
                var number = caller.GetNumber();
                var n      = Convert.ToInt32(number.Substring(1));
                Assert.LessOrEqual(1, n);
                Assert.GreaterOrEqual(75, n);
            }
        }