public async Task Edit() { var config = await this.Add(); var template = await this._templateController.Add(); var message = new HttpRequestMessage(HttpMethod.Put, API); var commond = new ConfigChangeCommand { Id = config.Id, Name = template.Name, Content = template.Format, TemplateId = template.Id }; message.AddJsonContent(commond); var responseMessage = await this.HttpClient.SendAsync(message); await responseMessage.AsResult(); var newConfig = await this.Get(config.Id); Assert.NotEqual(commond.Name, config.Name); Assert.NotEqual(commond.Content, config.Content); Assert.NotEqual(commond.TemplateId, config.TemplateId); Assert.Equal(commond.Name, newConfig.Name); Assert.Equal(commond.TemplateId, newConfig.TemplateId); Assert.Equal(commond.Content, newConfig.Content); }
public void Change(ConfigChangeCommand command) { this.Apply <ConfigChangeEvent>(command); }
public Task Handle(ConfigChangeCommand command) { return(this.Update(command.Id, s => s.Change(command))); }
public async Task <object> Put(ConfigChangeCommand command) { await this._mediator.Send(command); return(ResponseResult.Success); }