1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
6
using ICSharpCode.AvalonEdit.Document;
7
using ICSharpCode.NRefactory;
8
using ICSharpCode.SharpDevelop.Editor.AvalonEdit;
9
using ICSharpCode.XmlEditor;
10
using NUnit.Framework;
11
using XmlEditor.Tests.Utils;
13
namespace XmlEditor.Tests.Editor
16
public class ElementEndAddedAfterGreaterThanCharTypedTestFixture
18
XmlFormattingStrategy formattingStrategy;
19
MockTextEditor textEditor;
20
MockTextEditorOptions options;
21
AvalonEditDocumentAdapter document;
22
TextDocument textDocument;
27
formattingStrategy = new XmlFormattingStrategy();
29
options = new MockTextEditorOptions();
30
textEditor = new MockTextEditor();
31
textEditor.Options = options;
33
textDocument = new TextDocument();
34
document = new AvalonEditDocumentAdapter(textDocument, null);
35
textEditor.SetDocument(document);
42
// Just typed the '>' character of the <child> element
43
textEditor.Caret.Offset = 16;
44
formattingStrategy.FormatLine(textEditor, '>');
48
public void ChildEndElementAddedAfterGreaterThanCharTyped()
52
"\t<child></child>\r\n" +
55
Assert.AreEqual(expectedText, document.Text);
59
public void IndentCanBeUndoneInOneStep()
66
textDocument.UndoStack.Undo();
68
Assert.AreEqual(expectedText, textDocument.Text);
72
public void CursorIsJustBeforeEndElementTagAfterLinesFormatted()
74
int newCaretOffset = 16;
75
Assert.AreEqual(newCaretOffset, textEditor.Caret.Offset);