示例#1
0
        private void SetTitleCommandExecutor(string commandParams)
        {
            var argumentsParser = new ArgumentsParser(commandParams);

            if (argumentsParser.NextArgumentsCount < 1)
            {
                throw new MenuException();
            }

            ICommand command = new SetTitleCommand(argumentsParser.GetNextsAsString(' '), _document);

            command.Execute();
        }
示例#2
0
        public void Execute_DeleteItemInvoked()
        {
            // Arrange
            _document.Title = "1";
            var newTitle = "2";

            ICommand command = new SetTitleCommand(newTitle, _document);

            // Act
            command.Execute();

            // Assert
            Assert.Equal(newTitle, _document.Title);
        }
示例#3
0
        public void Unexecute_InsertItemInvoked()
        {
            // Arrange
            string oldTitle = "1";

            _document.Title = oldTitle;
            var newTitle = "2";

            ICommand command = new SetTitleCommand(newTitle, _document);

            command.Execute();

            // Act
            command.Unexecute();

            // Assert
            Assert.Equal(oldTitle, _document.Title);
        }
示例#4
0
 public IActionResult SetTitle([FromBody] SetTitleCommand command)
 {
     this.boardService.SetTitle(command);
     return(Ok(new { changed = true }));
 }