public void RetornaStatusCodeErrorDadoNenhumArquivoParaUpload()
        {
            UploadController upload = new UploadController(_registroCorridaServiceMock.Object, _corridaServiceMock.Object, _bonusServiceMock.Object);

            var mock             = new Mock <IFormFile>();
            var result           = upload.CarregarArquivo(mock.Object).Result;
            var badRequestResult = result as BadRequestObjectResult;

            Assert.IsNotNull(badRequestResult);
            Assert.AreEqual(400, badRequestResult.StatusCode);
            Assert.IsTrue(badRequestResult.Value.ToString().Contains("Nenhum Arquivo Selecionado"));
        }
        public void RetornaStatusCodeErrorDadoArquivoTiopoDiferenteDeTexto()
        {
            UploadController upload = new UploadController(_registroCorridaServiceMock.Object, _corridaServiceMock.Object, _bonusServiceMock.Object);

            var mock             = ObterMockIFromFilePDF();
            var result           = upload.CarregarArquivo(mock.Object).Result;
            var badRequestResult = result as BadRequestObjectResult;

            Assert.IsNotNull(badRequestResult);
            Assert.AreEqual(400, badRequestResult.StatusCode);
            Assert.IsTrue(badRequestResult.Value.ToString().Contains("Apenas arquivo texto"));
        }
        public void RetornaStatusCodeSucessoDadoArquivoFormatoCorreto()
        {
            string[] linhas = ObterTextoLogCorridaTeste().Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            List <RegistroCorrida>  registrosMock = _registroCorridaService.ObterRegistrosCorrida(linhas).Result;
            List <ResultadoCorrida> resultadoMock = _corridaService.ApresentarResultadoCorrida(registrosMock).Result;

            _registroCorridaServiceMock.Setup(x => x.ObterRegistrosCorrida(linhas)).Returns(Task.FromResult(registrosMock));
            _corridaServiceMock.Setup(x => x.ApresentarResultadoCorrida(registrosMock)).Returns(Task.FromResult(resultadoMock));

            UploadController upload = new UploadController(_registroCorridaServiceMock.Object, _corridaServiceMock.Object, _bonusServiceMock.Object);

            var mock     = ObterMockIFromFile();
            var result   = upload.CarregarArquivo(mock.Object).Result;
            var okResult = result as OkObjectResult;

            Assert.IsNotNull(okResult);
            Assert.AreEqual(200, okResult.StatusCode);
        }