public async Task Add_Information_To_The_Event() { FillData(); var command = new AddEventInformationCommand { Title = "Test", Description = "Test", Visible = true }; var response = await HttpClient.PostAsync($"/events/{_event.Id}/information", new StringContent(JsonConvert.SerializeObject(command), Encoding.UTF8, "application/json")); await HttpClient.PostAsync($"/events/{_event.Id}/information", new StringContent(JsonConvert.SerializeObject(command), Encoding.UTF8, "application/json")); response.StatusCode.Should().Be(HttpStatusCode.NoContent); RefreshContext(); _event = Context.Events.Include(x => x.Information).FirstOrDefault(s => s.Id == _event.Id); _event.Information.Count.Should().Be(2); _event.Information.First().Title.Should().Be(command.Title); _event.Information.First().Description.Should().Be(command.Description); _event.Information.First().Visible.Should().Be(command.Visible); }
public async Task <IActionResult> AddEventInformation([FromRoute] int eventId, [FromBody] AddEventInformationCommand command) { command.EventId = eventId; return(await _iMediator.Send(command)); }