Exemple #1
0
        public void GivenEmptyTitle_ThrowsException()
        {
            var request = new Request(Guid.Empty.ToString(), string.Empty);
            var rename  = new Rename(null);

            Assert.Throws <Exception>(() => rename.Execute(request));
        }
Exemple #2
0
        public void Rename(string oldKey, string newKey)
        {
            Check.IsNullOrWhiteSpace <ArgumentNullException>(oldKey);
            Check.IsNullOrWhiteSpace <ArgumentNullException>(newKey);

            using (var command = new Rename(host: _host, port: _port))
            {
                command.Execute(oldKey: oldKey, newKey: newKey);
            }
        }
 /// <summary>
 /// Invoked when the user selects the "Rename" command
 /// </summary>
 private void RenameClicked(Object sender, EventArgs e)
 {
     try
     {
         Rename command = new Rename(true);
         command.Execute();
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
 }
Exemple #4
0
 private static void ExecuteFirst()
 {
     try
     {
         currentCommand = queue.Dequeue();
         currentCommand.OnRefactorComplete += OnRefactorComplete;
         currentCommand.Execute();
     }
     catch (Exception ex)
     {
         queue.Clear();
         currentCommand = null;
         startState     = null;
         ErrorManager.ShowError(ex);
     }
 }
 static void ExecuteFirst()
 {
     try
     {
         currentCommand = queue[0];
         queue.Remove(currentCommand);
         currentCommand.OnRefactorComplete += OnRefactorComplete;
         currentCommand.Execute();
     }
     catch (Exception ex)
     {
         queue.Clear();
         currentCommand = null;
         ErrorManager.ShowError(ex);
     }
 }
 static void ExecuteFirst()
 {
     try
     {
         currentCommand = queue[0];
         queue.Remove(currentCommand);
         currentCommand.OnRefactorComplete += OnRefactorComplete;
         currentCommand.Execute();
     }
     catch (Exception ex)
     {
         queue.Clear();
         currentCommand = null;
         ErrorManager.ShowError(ex);
     }
 }
Exemple #7
0
        public void GivenTodoItem_TitleChanged()
        {
            var context         = new InMemoryContext();
            var gateway         = new InMemoryItemGateway(context);
            var responseHandler = new ResponseHandler();
            var entitiesFactory = new DefaultEntitiesFactory();

            var todo = new Core.UseCases.Todo(responseHandler, gateway, entitiesFactory);

            todo.Execute(new Core.Boundaries.Todo.Request("My Title"));

            var       request      = new Request(responseHandler.TodoItems[0].ItemId.ToString(), "New Title");
            var       updatedTitle = new Rename(gateway);
            Exception ex           = Record.Exception(() => updatedTitle.Execute(request));

            Assert.Null(ex);
        }
Exemple #8
0
      } // end HandleAction

      public static bool HandleAction(Connection connection, string sUserId, ActionTypes actionType, string sArg3)
      {
         int iArg3;

         switch (actionType)
         {
            case SandsOfTime.Actions.ActionTypes.Start:
               return (Start.Execute(connection, sUserId, sArg3) > 0);
            case SandsOfTime.Actions.ActionTypes.Stop:
               return (Stop.Execute(connection, sUserId) > 0);
            case SandsOfTime.Actions.ActionTypes.Resume:
               return (Resume.Execute(connection, sUserId, sArg3) > 0);
            case SandsOfTime.Actions.ActionTypes.Rename:
               return (Rename.Execute(connection, sUserId, sArg3) > 0);
            case SandsOfTime.Actions.ActionTypes.List:
               return (List.Execute(connection, sUserId, int.TryParse(sArg3, out iArg3) ? iArg3 : 0) > 0);
            default:
               return (false);
         } // end switch
      } // end HandleAction
Exemple #9
0
 /// <summary>
 /// Invoked when the user selects the "Rename" command
 /// </summary>
 private void RenameClicked(Object sender, EventArgs e)
 {
     try
     {
         Rename command = new Rename(true);
         command.Execute();
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
 }
Exemple #10
0
        public void GivenNullInput_ThrowsException()
        {
            var rename = new Rename(null);

            Assert.Throws <Exception>(() => rename.Execute(null));
        }
 private static void ExecuteFirst()
 {
     try
     {
         currentCommand = queue.Dequeue();
         currentCommand.OnRefactorComplete += OnRefactorComplete;
         currentCommand.Execute();
     }
     catch (Exception ex)
     {
         queue.Clear();
         currentCommand = null;
         startState = null;
         ErrorManager.ShowError(ex);
     }
 }