public void EnviarCandidato() { CandidatoModels candidato = new CandidatoModels { Nome = "Rafael Xavier", Email = "*****@*****.**", Css = 5, Html = 5, Javascript = 8 }; CandidatoController controller = new CandidatoController(); controller.ModelState.Clear(); IHttpActionResult result = controller.PostCandidato(candidato); OkNegotiatedContentResult <CandidatoModels> okNegotiatedContentResult = result as OkNegotiatedContentResult <CandidatoModels>; Assert.IsNotNull(okNegotiatedContentResult); Assert.AreEqual(candidato.Nome, okNegotiatedContentResult.Content.Nome); Assert.AreEqual(candidato.Android, okNegotiatedContentResult.Content.Android); Assert.AreEqual(candidato.Css, okNegotiatedContentResult.Content.Css); Assert.AreEqual(candidato.Django, okNegotiatedContentResult.Content.Django); Assert.AreEqual(candidato.Email, okNegotiatedContentResult.Content.Email); Assert.AreEqual(candidato.Html, okNegotiatedContentResult.Content.Html); Assert.AreEqual(candidato.Ios, okNegotiatedContentResult.Content.Ios); Assert.AreEqual(candidato.Javascript, okNegotiatedContentResult.Content.Javascript); Assert.AreEqual(candidato.Python, okNegotiatedContentResult.Content.Python); }
public void EnviarCandidatoHardcore() { CandidatoModels candidato = new CandidatoModels { Nome = "Rafael Xavier", Email = "*****@*****.**", Css = 10, Android = 10, Django = 10, Html = 10, Ios = 10, Python = 10, Javascript = 10 }; CandidatoController controller = new CandidatoController(); controller.ModelState.Clear(); IHttpActionResult result = controller.PostCandidato(candidato); OkNegotiatedContentResult <CandidatoModels> okNegotiatedContentResult = result as OkNegotiatedContentResult <CandidatoModels>; Assert.IsNotNull(okNegotiatedContentResult); Assert.IsTrue(candidato.FrontEnd); Assert.IsTrue(candidato.BackEnd); Assert.IsTrue(candidato.Mobile); Assert.IsFalse(candidato.Programador); }
public CandidatoControllerTeste() { AutoMapperConfiguration.Configure(); candidatoRepository = new Mock <ICandidatoRepository>(); var candidatoService = new Mock <CandidatoService>(candidatoRepository.Object); controller = new CandidatoController(Mapper.Instance, candidatoService.Object); }
public void InicializaTeste() { _mock = new Mock <IUnityOfWork>(); _queryParams = new QueryParams(); _mock.Setup(x => x.CandidatoRepositorio.Buscar(c => true, ref _queryParams)).Returns(CandidatoDados.GetCandidatos(0)); _mock.Setup(x => x.CandidatoRepositorio.Obter(ref _queryParams)).Returns(CandidatoDados.GetCandidatos(4)); _controller = new CandidatoController(_mock.Object); }
public void SelectCandidatosByID() { // Set up Prerequisites var controller = new CandidatoController { Request = new HttpRequestMessage(), Configuration = new HttpConfiguration() }; // Act on Test var response = controller.Get(1); // Assert the result Assert.IsTrue(response.TryGetContentValue(out Candidato candidato)); Assert.AreEqual("Luiz Bruno", candidato.Nome); }
public void DeleteEntity() { // Set up Prerequisites var controller = new CandidatoController { Request = new HttpRequestMessage(), Configuration = new HttpConfiguration() }; // Act on Test var response = controller.Delete(2); // Assert the result Assert.IsTrue(response.TryGetContentValue(out string msg)); Assert.AreEqual("Removido", "Removido"); }
public void EnviarCandidatoSemEmail() { CandidatoModels candidato = new CandidatoModels { Nome = "Rafael Xavier", Css = 5, Html = 5, Javascript = 8 }; CandidatoController controller = new CandidatoController(); controller.ModelState.Clear(); IHttpActionResult result = controller.PostCandidato(candidato); BadRequestErrorMessageResult badRequestErrorMessageResult = result as BadRequestErrorMessageResult; Assert.IsNotNull(badRequestErrorMessageResult); Assert.AreEqual("E-mail não pode ser nulo ou inválido.", badRequestErrorMessageResult.Message); }
public void EnviarCandidatoSemNome() { CandidatoModels candidato = new CandidatoModels { Email = "*****@*****.**", Css = 5, Html = 5, Javascript = 8 }; CandidatoController controller = new CandidatoController(); controller.ModelState.Clear(); IHttpActionResult result = controller.PostCandidato(candidato); BadRequestErrorMessageResult badRequestErrorMessageResult = result as BadRequestErrorMessageResult; Assert.IsNotNull(badRequestErrorMessageResult); Assert.AreEqual("Nome não pode ser nulo.", badRequestErrorMessageResult.Message); }
public CandidatoControllerTest(IContatoRepository candidatoRepository) { _repository = candidatoRepository; _controller = new CandidatoController(candidatoRepository); }
public void InsertEntity() { // Set up Prerequisites var controller = new CandidatoController { Request = new HttpRequestMessage(), Configuration = new HttpConfiguration() }; // Act on Test Candidato candidato = new Candidato() { Nome = "Jose Luiz", Email = "*****@*****.**", Skype = "jose.luiz55", Telefone = "13 978028056", Linkedin = "joseluiz", Cidade = "Cubatao", Estado = "SP", Portfolio = "portfolio", PretensaoSalarial = 25, NomeBanco = "Caixa Economica", NomeBeneficiarioBanco = "Jose Luiz", CpfBeneficiarioBanco = "11223344556", TipoConta = "Corrente", AgenciaBanco = "012", ContaBanco = "012345-5", LinkCrud = "linkcrud.jl", candidatoConhecimentos = new List <CandidatoConhecimento> { new CandidatoConhecimento { IdConhecimento = 1, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 2, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 3, Nivel = 2 }, new CandidatoConhecimento { IdConhecimento = 4, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 5, Nivel = 4 }, new CandidatoConhecimento { IdConhecimento = 6, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 7, Nivel = 4 }, new CandidatoConhecimento { IdConhecimento = 8, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 9, Nivel = 2 }, new CandidatoConhecimento { IdConhecimento = 10, Nivel = 1 }, new CandidatoConhecimento { IdConhecimento = 11, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 12, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 13, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 14, Nivel = 4 }, new CandidatoConhecimento { IdConhecimento = 15, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 16, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 17, Nivel = 2 }, new CandidatoConhecimento { IdConhecimento = 18, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 19, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 20, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 21, Nivel = 5 }, new CandidatoConhecimento { IdConhecimento = 22, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 23, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 24, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 25, Nivel = 3 }, new CandidatoConhecimento { IdConhecimento = 26, DsOutros = "Delphi 3" } }, candidatoHorarios = new List <CandidatoHorario> { new CandidatoHorario { IdHorario = 3 }, new CandidatoHorario { IdHorario = 4 } }, candidatoPeriodos = new List <CandidatoPeriodo> { new CandidatoPeriodo { IdPeriodo = 2 }, new CandidatoPeriodo { IdPeriodo = 4 }, new CandidatoPeriodo { IdPeriodo = 5 } } }; var response = controller.Post(candidato); // Assert the result Assert.IsTrue(response.TryGetContentValue(out string msg)); Assert.AreEqual("Inserido", "Inserido"); }