Beispiel #1
0
        public async Task Add_Material()
        {
            FillData();

            var command = new AddMaterialCommand
            {
                Title = "Test",
                Link  = "http://test.com.ar"
            };
            var response = await HttpClient.PostAsync($"/events/{_event.Id}/materials",
                                                      new StringContent(JsonConvert.SerializeObject(command), Encoding.UTF8, "application/json"));

            await HttpClient.PostAsync($"/events/{_event.Id}/materials",
                                       new StringContent(JsonConvert.SerializeObject(command), Encoding.UTF8, "application/json"));

            response.StatusCode.Should().Be(HttpStatusCode.NoContent);

            RefreshContext();
            _event = Context.Events.Include(x => x.Materials).FirstOrDefault(s => s.Id == _event.Id);

            _event.Materials.Count.Should().Be(2);
            _event.Materials.First().Title.Should().Be(command.Title);
            _event.Materials.First().Link.Should().Be(command.Link);
        }
 public async Task <IActionResult> PutCheckAttendanceGeneral([FromRoute] int eventId, [FromBody] AddMaterialCommand command)
 {
     command.EventId = eventId;
     return(await _iMediator.Send(command));
 }