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);
        }
Exemplo n.º 2
0
 public void Change(ConfigChangeCommand command)
 {
     this.Apply <ConfigChangeEvent>(command);
 }
Exemplo n.º 3
0
 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);
        }