/// <summary> /// Integrates single operation into the Teletype document. /// </summary> /// <param name="replica">Teletype document instance</param> /// <param name="operation">Operation to integrate</param> protected void IntegrateOperations(TestDocument replica, IOperation operation) { IntegrateOperations(replica, new[] { operation }); }
/// <summary> /// Inserts <paramref name="text"/> into the Teletype document at a given <paramref name="position"/>. /// </summary> /// <param name="replica">Teletype document instance</param> /// <param name="position">Position to insert the text at</param> /// <param name="text">Text to insert</param> /// <returns>Teletype splice operation that represents text insertion.</returns> protected SpliceOperation PerformInsert(TestDocument replica, Point position, string text) { return(PerformSetTextInRange(replica, position, position, text)); }
/// <summary> /// Deletes the text in the Teletype document. /// </summary> /// <param name="replica">Teletype document instance</param> /// <param name="start">Start of the deletion range</param> /// <param name="end">End of the deletion range</param> /// <returns>Teletype splice operation that represents text deletion.</returns> protected SpliceOperation PerformDelete(TestDocument replica, Point start, Point end) { return(PerformSetTextInRange(replica, start, end, "")); }
/// <summary> /// Reverts changes done by the given set of operations. /// </summary> /// <param name="replica">Teletype document instance</param> /// <param name="operationToUndo">Operations to undo</param> /// <returns>Collection of counter-operations.</returns> private IReadOnlyList <UndoOperation> PerformUndoOrRedoOperations(TestDocument replica, IOperation operationToUndo) { var(operations, textUpdates) = replica.UndoRedoOperations(new[] { operationToUndo }); replica.TestLocalDocument.UpdateText(textUpdates); return(operations); }