Esempio n. 1
0
        public void IsDrawValid_SumInRange_False()
        {
            var drawsService = new DrawsService(config);

            Draw drawBellowRange = new Draw
            {
                Date    = DateTime.Now,
                Numbers = new int[] { 1, 2, 10, 12, 25 },
                Stars   = new int[] { 4, 5 }
            };

            bool resultBellowRange = drawsService.IsDrawValid(drawBellowRange);

            Draw drawAboveRange = new Draw
            {
                Date    = DateTime.Now,
                Numbers = new int[] { 23, 30, 35, 40, 41 },
                Stars   = new int[] { 1, 7 }
            };

            bool resultAboveRange = drawsService.IsDrawValid(drawAboveRange);

            Assert.IsFalse(resultBellowRange, "Draw bellow range.");
            Assert.IsFalse(resultAboveRange, "Draw above range.");
        }
Esempio n. 2
0
        public void IsDrawValid_IsEvenNumbersCountInRange_False()
        {
            var drawsService = new DrawsService(config);

            Draw drawAllEven = new Draw
            {
                Date    = DateTime.Now,
                Numbers = new int[] { 2, 10, 24, 36, 42 },
                Stars   = new int[] { 1, 7 }
            };

            bool resultAllEven = drawsService.IsDrawValid(drawAllEven);

            Draw drawAllOdd = new Draw
            {
                Date    = DateTime.Now,
                Numbers = new int[] { 1, 13, 25, 33, 39 },
                Stars   = new int[] { 1, 7 }
            };

            bool resultAllOdd = drawsService.IsDrawValid(drawAllOdd);

            Assert.IsFalse(resultAllEven, "Draw can't be all even numbers.");
            Assert.IsFalse(resultAllOdd, "Draw can't be all odd numbers.");
        }
Esempio n. 3
0
        public void IsDrawValid_IsEvenNumbersCountInRange_True()
        {
            var drawsService = new DrawsService(config);

            Draw drawEvenOverOdd = new Draw
            {
                Date    = DateTime.Now,
                Numbers = new int[] { 2, 12, 24, 27, 35 },

                Stars = new int[] { 1, 7 }
            };

            bool resultEvenOverOdd = drawsService.IsDrawValid(drawEvenOverOdd);

            Draw drawOddOverEven = new Draw
            {
                Date    = DateTime.Now,
                Numbers = new int[] { 1, 13, 25, 26, 32 },
                Stars   = new int[] { 1, 7 }
            };

            bool resultOddOverEven = drawsService.IsDrawValid(drawOddOverEven);

            Assert.IsTrue(resultEvenOverOdd, "Draw wih 3 even numbers.");
            Assert.IsTrue(resultOddOverEven, "Draw with 2 even numbers.");
        }
Esempio n. 4
0
        public void IsDrawValid_SumInRange_True()
        {
            var drawsService = new DrawsService(config);

            Draw draw = new Draw
            {
                Date    = DateTime.Now,
                Numbers = new int[] { 4, 10, 20, 33, 45 },
                Stars   = new int[] { 2, 3 }
            };

            bool result = drawsService.IsDrawValid(draw);

            Assert.IsTrue(result, "Draw sum is in range.");
        }
Esempio n. 5
0
        public void IsDrawValid_IsSequentialNumber_False()
        {
            var drawsService = new DrawsService(config);

            Draw draw = new Draw
            {
                Date    = DateTime.Now,
                Numbers = new int[] { 23, 24, 25, 26, 27 },
                Stars   = new int[] { 2, 3 }
            };

            bool result = drawsService.IsDrawValid(draw);

            Assert.IsFalse(result, "Draw can't be sequential number.");
        }
Esempio n. 6
0
        public void IsDrawValid_IsSequentialNumber_True()
        {
            var drawsService = new DrawsService(config);

            Draw draw = new Draw
            {
                Date    = DateTime.Now,
                Numbers = new int[] { 4, 10, 20, 33, 45 },
                Stars   = new int[] { 2, 3 }
            };

            bool result = drawsService.IsDrawValid(draw);

            Assert.IsTrue(result, "Draw is not sequential number.");
        }
Esempio n. 7
0
        public void IsDrawValid_PastDraws_False()
        {
            var drawsService = new DrawsService(config);
            var dataService  = new DataService(config);

            Draw draw = new Draw
            {
                Date    = DateTime.Now,
                Numbers = new int[] { 18, 20, 35, 38, 48 },
                Stars   = new int[] { 9, 12 }
            };

            List <Draw> pastDraws = dataService.ReadFile(Entities.Type.Drawn);

            bool result = drawsService.IsDrawValid(draw, pastDraws);

            Assert.IsFalse(result, "Draw was previously drawn.");
        }
Esempio n. 8
0
        public void IsDrawValid_PastDraws_True()
        {
            var drawsService = new DrawsService(config);
            var dataService  = new DataService(config);

            Draw draw = new Draw
            {
                Date    = DateTime.Now,
                Numbers = new int[] { 10, 11, 20, 31, 45 },
                Stars   = new int[] { 2, 3 }
            };

            List <Draw> pastDraws = dataService.ReadFile(Entities.Type.Drawn);

            bool result = drawsService.IsDrawValid(draw, pastDraws);

            Assert.IsTrue(result, "Draw was not previously drawn.");
        }