public async Task <IActionResult> UpdateChurch([FromBody] ChurchUpdatedMessageRequest view) { var command = _mapper.Map <UpdateChurchCommand>(view); await _bus.SendCommand(command); return(Response(view)); }
public async Task Update_church() { //Arrang's var churchId = CreateChurch(); var requestMessage = new ChurchUpdatedMessageRequest { Id = churchId, Name = "Name updated", Photo = "Photo updated", Email = "*****@*****.**", CellPhone = "999999999", //Telephone must be between 8 and 9 characters. HomePhone = "2166666666" }; //Act var response = await BaseIntegrationTest.PutAsync(requestMessage, "Church/update"); //Assert's response.Should().NotBeNull(); response.IsSuccessStatusCode.Should().BeTrue(); response.StatusCode.Should().Be(HttpStatusCode.OK); Action assert = () => { //var unitOfWork = Setup.Container.GetService<IUnitOfWork>(); //var churchUpdate = unitOfWork.DbSet<Church>().FirstOrDefault(x => x.Id == churchId); //churchUpdate.Id.Should().Be(churchId); //churchUpdate.Name.Should().Be(requestMessage.Name); //churchUpdate.Photo.Should().Be(requestMessage.Photo); //churchUpdate.Email.Value.Should().Be(requestMessage.Email); //churchUpdate.MobileTelephone.Number.Should().Be(requestMessage.MobileTelephone); //churchUpdate.TelephoneFixed.Number.Should().Be(requestMessage.TelephoneFixed); }; assert(); }