public SaveIdeaResultDto UpdateIdea(UpdateIdeaDto input) { UserAccess(); _ideaRepository.UpdateRaw("Ideas", $"Id = {input.Id}", new Dictionary <string, object>() { { nameof(input.Description), input.Description }, { nameof(input.Title), input.Title }, }); return(new SaveIdeaResultDto(GetById(input.Id))); }
public void Should_Update_Idea() { AuthorizeUser(); var service = GetService <IIdeaService>(); var existingIdea = service.CreateIdea(new CreateIdeaDto { Description = "Lorem", Title = "Ipsum" }); var updateIdeaInput = new UpdateIdeaDto { Id = existingIdea.Id, Description = "Lorem 2", Title = "Ipsum 1" }; var result = service.UpdateIdea(updateIdeaInput); result.Should().NotBeNull(); result.Description.Should().BeEquivalentTo(updateIdeaInput.Description); result.Title.Should().BeEquivalentTo(updateIdeaInput.Title); }