public async Task <ObjectResult> Current([FromBody] DrawRequest request)
        {
            IEnumerable <CurrentDraw> response = null;

            try
            {
                // If the basic request has not been supplied properly, exit straight away
                if (!request.IsValid())
                {
                    return(BadRequestResult());
                }

                response = await _lottoDrawService.GetCurrentDraws(request);
            }
            catch (InvalidDataException ide)
            {
                return(BadRequest($"Invalid Request: {ide.Message}"));
            }
            catch (Exception ex) // In the case of an internal server error, return a general 500 (generally would log this).
            {
                Console.WriteLine(ex.Message);
                return(StatusCode(500, response));
            }

            return(new OkObjectResult(response));
        }
        public void GetCurrentDraws_WithNullOrEmptyDrawsReturned_ThrowsAppropriateError()
        {
            // Arrange
            var request = LottoDrawData.ValidDrawRequest;

            ConfigureCurrentRepository(LottoDrawData.NullCurrentDrawsResponse, request);
            _lottoDrawService = new LottoDrawService(_openRepoMock.Object, _currentRepoMock.Object);

            // Act
            // Assert
            Assert.Throws <InvalidDataException>(() => _lottoDrawService.GetCurrentDraws(request));
        }
        public async Task GetCurrentDraws_WithValidRequest_ReturnsValidResponseWithoutErrors()
        {
            // Arrange
            var request = LottoDrawData.ValidDrawRequest;

            ConfigureCurrentRepository(LottoDrawData.ValidCurrentDrawsResponse, request);
            _lottoDrawService = new LottoDrawService(_openRepoMock.Object, _currentRepoMock.Object);

            // Act
            var currentDraws = await _lottoDrawService.GetCurrentDraws(request);

            // Assert
            Assert.That(currentDraws, Is.Not.Null.Or.Empty);
            var currentDrawsList = currentDraws.ToList();

            Assert.That(currentDrawsList.Count, Is.GreaterThan(0));
        }