コード例 #1
0
        public ActionResult <ParticipanteResponseModel> Post(ParticipanteCreateRequest model)
        {
            if (ModelState.IsValid)
            {
                return(Ok(_svc.InserirParticipante(model)));
            }

            return(BadRequest(ModelState));
        }
コード例 #2
0
        public async Task Post_Participantes_Theory(ParticipanteCreateRequest model, HttpStatusCode statusCode)
        {
            var jsonString = JsonConvert.SerializeObject(model);

            // Wrap our JSON inside a StringContent which then can be used by the HttpClient class
            var httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json");

            var client = _factory.CreateClient();

            var response = await client.PostAsync("/api/Participantes", httpContent);

            Assert.Equal(statusCode, response.StatusCode);
        }
コード例 #3
0
        public Participacao InserirParticipante(ParticipanteCreateRequest model)
        {
            if (model == null)
            {
                return(null);
            }

            Participacao participante = new Participacao()
            {
                IdEvento          = model.IdEvento,
                LoginParticipante = model.LoginParticipante,
                Nota         = 0,
                FlagPresente = false,
                Comentario   = " "
            };

            participante = _repositorio.Adicionar(participante);

            return(participante);
        }
コード例 #4
0
        public void InserirParticipante_Vazio_Theory(ParticipanteCreateRequest model, bool equalsNull)
        {
            var result = _service.InserirParticipante(model);

            Assert.True((result == null) == equalsNull);
        }