public ApplicationInsertResponse Index([FromBody] ApplicationInsertRequest rq) { ApplicationInsertResponse rsp = new ApplicationInsertResponse(); try { Application application = _mapper.Map <Application>(rq); bool insert = _applicationsService.ApplicationInsert(application); if (insert) { rsp = new ApplicationInsertResponse() { ErrorNumber = 0, Message = "Cadidatura cadastrada com successo Boa sorte", Data = new { successo = insert } } } ; else { rsp = new ApplicationInsertResponse() { ErrorNumber = 2, Message = "Não foi possivel completar sua candidatura por causa de um erro", Data = new { successo = insert } } }; } catch (Exception ex) { rsp = new ApplicationInsertResponse() { ErrorNumber = 1, Message = "Erro no servidor" }; } return(rsp); }
public void TestInsertApplication() { Application application = fixture.Create <Application>(); _applicationsRepository.Setup(x => x.ApplicationInsert(application)).Returns(true); bool applicationInserted = service.ApplicationInsert(application); if (!applicationInserted) { Assert.Fail(); } _applicationsRepository.VerifyAll(); Assert.Pass(); }