Browse Source

fixed some tests

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/XmlEditor@4192 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 17 years ago
parent
commit
1cba649b35
  1. 16
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XPathNodeTextMarker.cs
  2. 3
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XPathQueryControl.cs
  3. 6
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCompletionItemCollection.cs
  4. 2
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlDisplayBinding.cs
  5. 4
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs
  6. 6
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs
  7. 3
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionDataCollection.cs
  8. 3
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlTreeEditor.cs
  9. 3
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlTreeViewContainerControl.cs
  10. 2
      src/AddIns/DisplayBindings/XmlEditor/Test/Tree/XmlTreeViewClipboardHandlerTestFixture.cs
  11. 24
      src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockDocument.cs
  12. 83
      src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockTextMarker.cs
  13. 40
      src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockTextMarkerService.cs
  14. 5
      src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockXmlViewContent.cs
  15. 181
      src/AddIns/DisplayBindings/XmlEditor/Test/XPathQuery/XPathNodeTextMarkerTests.cs
  16. 18
      src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
  17. 9
      src/Main/Base/Project/Src/Editor/AvalonEdit/AvalonEditDocumentAdapter.cs

16
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XPathNodeTextMarker.cs

@ -22,9 +22,9 @@ namespace ICSharpCode.XmlEditor
static List<XPathNodeTextMarker> markers = new List<XPathNodeTextMarker>(); static List<XPathNodeTextMarker> markers = new List<XPathNodeTextMarker>();
ITextMarker marker; ITextMarker marker;
XPathNodeTextMarker(ITextEditor editor, int offset, XPathNodeMatch node) XPathNodeTextMarker(IDocument document, int offset, XPathNodeMatch node)
{ {
ITextMarkerService markerService = editor.GetService(typeof(ITextMarkerService)) as ITextMarkerService; ITextMarkerService markerService = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService;
marker = markerService.Create(offset, node.DisplayValue.Length); marker = markerService.Create(offset, node.DisplayValue.Length);
marker.Tag = this; marker.Tag = this;
} }
@ -32,29 +32,29 @@ namespace ICSharpCode.XmlEditor
/// <summary> /// <summary>
/// Adds markers for each XPathNodeMatch. /// Adds markers for each XPathNodeMatch.
/// </summary> /// </summary>
public static void AddMarkers(ITextEditor editor, XPathNodeMatch[] nodes) public static void AddMarkers(IDocument document, XPathNodeMatch[] nodes)
{ {
foreach (XPathNodeMatch node in nodes) { foreach (XPathNodeMatch node in nodes) {
AddMarker(editor, node); AddMarker(document, node);
} }
} }
/// <summary> /// <summary>
/// Adds a single marker for the XPathNodeMatch. /// Adds a single marker for the XPathNodeMatch.
/// </summary> /// </summary>
public static void AddMarker(ITextEditor editor, XPathNodeMatch node) public static void AddMarker(IDocument document, XPathNodeMatch node)
{ {
if (node.HasLineInfo() && node.Value.Length > 0) { if (node.HasLineInfo() && node.Value.Length > 0) {
markers.Add(new XPathNodeTextMarker(editor, editor.Document.PositionToOffset(node.LineNumber, node.LinePosition), node)); markers.Add(new XPathNodeTextMarker(document, document.PositionToOffset(node.LineNumber + 1, node.LinePosition), node));
} }
} }
/// <summary> /// <summary>
/// Removes all the XPathNodeMarkers from the marker strategy. /// Removes all the XPathNodeMarkers from the marker strategy.
/// </summary> /// </summary>
public static void RemoveMarkers(ITextEditor editor) public static void RemoveMarkers(IDocument document)
{ {
ITextMarkerService markerService = editor.GetService(typeof(ITextMarkerService)) as ITextMarkerService; ITextMarkerService markerService = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService;
foreach (ITextMarker marker in markerService.TextMarkers) { foreach (ITextMarker marker in markerService.TextMarkers) {
if (marker.Tag is XPathNodeTextMarker) if (marker.Tag is XPathNodeTextMarker)
marker.Delete(); marker.Delete();

3
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XPathQueryControl.cs

File diff suppressed because one or more lines are too long

6
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCompletionItemCollection.cs

@ -56,7 +56,8 @@ namespace ICSharpCode.XmlEditor
public void AddRange(XmlCompletionItem[] val) public void AddRange(XmlCompletionItem[] val)
{ {
for (int i = 0; i < val.Length; i++) { for (int i = 0; i < val.Length; i++) {
this.Add(val[i]); if (!Contains(val[i].Text))
this.Add(val[i]);
} }
} }
@ -70,7 +71,8 @@ namespace ICSharpCode.XmlEditor
public void AddRange(XmlCompletionItemCollection val) public void AddRange(XmlCompletionItemCollection val)
{ {
for (int i = 0; i < val.Count; i++) for (int i = 0; i < val.Count; i++)
this.Add(val[i]); if (!Contains(val[i].Text))
this.Add(val[i]);
} }
public bool Contains(string name) public bool Contains(string name)

2
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlDisplayBinding.cs

@ -88,6 +88,8 @@ namespace ICSharpCode.XmlEditor
public static bool XmlViewContentActive { public static bool XmlViewContentActive {
get { get {
if (WorkbenchSingleton.Workbench == null)
return false;
ITextEditorProvider view = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider; ITextEditorProvider view = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider;
if (view != null) if (view != null)
return IsFileNameHandled(view.TextEditor.FileName); return IsFileNameHandled(view.TextEditor.FileName);

4
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs

File diff suppressed because one or more lines are too long

6
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs

File diff suppressed because one or more lines are too long

3
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionDataCollection.cs

@ -97,8 +97,7 @@ namespace ICSharpCode.XmlEditor
/// <seealso cref='XmlSchemaCompletionDataCollection.Add'/> /// <seealso cref='XmlSchemaCompletionDataCollection.Add'/>
public void AddRange(XmlSchemaCompletionDataCollection val) public void AddRange(XmlSchemaCompletionDataCollection val)
{ {
for (int i = 0; i < val.Count; i++) for (int i = 0; i < val.Count; i++) {
{
this.Add(val[i]); this.Add(val[i]);
} }
} }

3
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlTreeEditor.cs

File diff suppressed because one or more lines are too long

3
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlTreeViewContainerControl.cs

File diff suppressed because one or more lines are too long

2
src/AddIns/DisplayBindings/XmlEditor/Test/Tree/XmlTreeViewClipboardHandlerTestFixture.cs

@ -37,7 +37,7 @@ namespace XmlEditor.Tests.Tree
{ {
MockOpenedFile openedFile = new MockOpenedFile("test.xml"); MockOpenedFile openedFile = new MockOpenedFile("test.xml");
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection(); XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
xmlView = new MockXmlViewContent(); xmlView = new MockXmlViewContent(openedFile);
view = new XmlTreeView(xmlView); view = new XmlTreeView(xmlView);
treeViewContainer = (XmlTreeViewContainerControl)view.Control; treeViewContainer = (XmlTreeViewContainerControl)view.Control;
treeView = treeViewContainer.TreeView; treeView = treeViewContainer.TreeView;

24
src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockDocument.cs

@ -1,24 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision: 2498 $</version>
// </file>
using ICSharpCode.TextEditor.Document;
using System;
using System.Collections.Generic;
namespace XmlEditor.Tests.Utils
{
/// <summary>
/// Helper class that implements the Text Editor library's IDocument interface.
/// </summary>
public class MockDocument
{
public static IDocument Create()
{
return new DocumentFactory().CreateDocument();
}
}
}

83
src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockTextMarker.cs

@ -0,0 +1,83 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.Editor;
using System.Windows.Media;
namespace XmlEditor.Tests.Utils
{
public class MockTextMarker : ITextMarker
{
public event EventHandler Deleted;
List<ITextMarker> markers;
int start, end, length;
public MockTextMarker(List<ITextMarker> markers, int start, int end, int length)
{
this.markers = markers;
this.start = start;
this.end = end;
this.length = length;
}
public int StartOffset {
get {
return this.start;
}
}
public int EndOffset {
get {
return this.end;
}
}
public int Length {
get {
return this.length;
}
}
public bool IsDeleted {
get {
return !markers.Contains(this);
}
}
public Nullable<Color> BackgroundColor {
get {
return null;
}
set {
}
}
public Nullable<Color> ForegroundColor {
get {
return null;
}
set {
}
}
public object Tag {
get {
return null;
}
set {
}
}
public void Delete()
{
this.markers.Remove(this);
}
}
}

40
src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockTextMarkerService.cs

@ -0,0 +1,40 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.Editor;
using System.Windows.Media;
namespace XmlEditor.Tests.Utils
{
/// <summary>
/// Description of MockTextEditor.
/// </summary>
public class MockTextMarkerService : ITextMarkerService
{
List<ITextMarker> markers;
public MockTextMarkerService()
{
this.markers = new List<ITextMarker>();
}
public System.Collections.Generic.IEnumerable<ITextMarker> TextMarkers {
get {
return this.markers;
}
}
public ITextMarker Create(int startOffset, int length)
{
ITextMarker m = new MockTextMarker(this.markers, startOffset, startOffset + length, length);
this.markers.Add(m);
return m;
}
}
}

5
src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockXmlViewContent.cs

@ -17,12 +17,13 @@ namespace XmlEditor.Tests.Utils
/// </summary> /// </summary>
public class MockXmlViewContent : AbstractViewContent, IFileDocumentProvider public class MockXmlViewContent : AbstractViewContent, IFileDocumentProvider
{ {
OpenedFile file;
AvalonEditDocumentAdapter document; AvalonEditDocumentAdapter document;
public MockXmlViewContent() public MockXmlViewContent(OpenedFile file)
{ {
this.file = file;
this.document = new AvalonEditDocumentAdapter(); this.document = new AvalonEditDocumentAdapter();
this.Files.Add(new MockOpenedFile("test.xml"));
} }
public override object Control { public override object Control {

181
src/AddIns/DisplayBindings/XmlEditor/Test/XPathQuery/XPathNodeTextMarkerTests.cs

@ -5,14 +5,15 @@
// <version>$Revision: 2498 $</version> // <version>$Revision: 2498 $</version>
// </file> // </file>
using ICSharpCode.TextEditor.Document;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel.Design;
using System.Xml; using System.Xml;
using System.Xml.XPath; using System.Xml.XPath;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using XmlEditor.Tests.Utils; using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.XPathQuery namespace XmlEditor.Tests.XPathQuery
@ -20,87 +21,97 @@ namespace XmlEditor.Tests.XPathQuery
[TestFixture] [TestFixture]
public class XPathNodeTextMarkerTests public class XPathNodeTextMarkerTests
{ {
// TODO : reimplement tests using new mock classes [Test]
// [Test] public void OneNodeMarked()
// public void OneNodeMarked() {
// { string xml = "<root><foo/></root>";
// string xml = "<root><foo/></root>"; XPathNodeMatch[] nodes = XmlView.SelectNodes(xml, "//root");
// XPathNodeMatch[] nodes = XmlView.SelectNodes(xml, "//root");
// ServiceContainer container = new ServiceContainer();
// IDocument doc = MockDocument.Create(); container.AddService(typeof(ITextMarkerService), new MockTextMarkerService());
// doc.TextContent = xml;
// MarkerStrategy markerStrategy = new MarkerStrategy(doc);
// XPathNodeTextMarker.AddMarkers(markerStrategy, nodes); AvalonEditDocumentAdapter doc = new AvalonEditDocumentAdapter(container);
// doc.Text = xml;
// List<TextMarker> markers = new List<TextMarker>(); XPathNodeTextMarker.AddMarkers(doc, nodes);
// foreach (TextMarker marker in markerStrategy.TextMarker) {
// markers.Add(marker); ITextMarkerService service = doc.GetService(typeof(ITextMarkerService)) as ITextMarkerService;
// }
// List<ITextMarker> markers = new List<ITextMarker>();
// // Remove markers. foreach (ITextMarker marker in service.TextMarkers) {
// XPathNodeTextMarker.RemoveMarkers(markerStrategy); markers.Add(marker);
// List<TextMarker> markersAfterRemove = new List<TextMarker>(); }
// foreach (TextMarker markerAfterRemove in markerStrategy.TextMarker) {
// markers.Add(markerAfterRemove); // Remove markers.
// } XPathNodeTextMarker.RemoveMarkers(doc);
// List<ITextMarker> markersAfterRemove = new List<ITextMarker>();
// XPathNodeTextMarker xpathNodeTextMarker = (XPathNodeTextMarker)markers[0]; foreach (ITextMarker markerAfterRemove in service.TextMarkers) {
// Assert.AreEqual(1, markers.Count); markersAfterRemove.Add(markerAfterRemove);
// Assert.AreEqual(1, xpathNodeTextMarker.Offset); }
// Assert.AreEqual(4, xpathNodeTextMarker.Length);
// Assert.AreEqual(TextMarkerType.SolidBlock, xpathNodeTextMarker.TextMarkerType); ITextMarker xpathNodeTextMarker = markers[0];
// Assert.AreEqual(0, markersAfterRemove.Count); Assert.AreEqual(1, markers.Count, "markers.Count");
// Assert.AreEqual(XPathNodeTextMarker.MarkerBackColor, xpathNodeTextMarker.Color); Assert.AreEqual(1, xpathNodeTextMarker.StartOffset, "startoffset");
// } Assert.AreEqual(4, xpathNodeTextMarker.Length, "length");
// Assert.AreEqual(0, markersAfterRemove.Count, "afterremove.count");
// /// <summary> }
// /// Tests that XPathNodeMatch with an empty string value are not marked since
// /// the MarkerStrategy cannot use a TextMarker with a length of 0. /// <summary>
// /// </summary> /// Tests that XPathNodeMatch with an empty string value are not marked since
// [Test] /// the MarkerStrategy cannot use a TextMarker with a length of 0.
// public void EmptyCommentNode() /// </summary>
// { [Test]
// string xml = "<!----><root/>"; public void EmptyCommentNode()
// XPathNodeMatch[] nodes = XmlView.SelectNodes(xml, "//comment()"); {
// string xml = "<!----><root/>";
// IDocument doc = MockDocument.Create(); XPathNodeMatch[] nodes = XmlView.SelectNodes(xml, "//comment()");
// doc.TextContent = xml;
// MarkerStrategy markerStrategy = new MarkerStrategy(doc); ServiceContainer container = new ServiceContainer();
// XPathNodeTextMarker.AddMarkers(markerStrategy, nodes); container.AddService(typeof(MockTextMarkerService), new MockTextMarkerService());
//
// List<TextMarker> markers = new List<TextMarker>(); AvalonEditDocumentAdapter doc = new AvalonEditDocumentAdapter(container);
// foreach (TextMarker marker in markerStrategy.TextMarker) { doc.Text = xml;
// markers.Add(marker); XPathNodeTextMarker.AddMarkers(doc, nodes);
// }
// ITextMarkerService service = doc.GetService(typeof(MockTextMarkerService)) as ITextMarkerService;
// Assert.AreEqual(0, markers.Count);
// Assert.AreEqual(1, nodes.Length); List<ITextMarker> markers = new List<ITextMarker>();
// } foreach (ITextMarker marker in service.TextMarkers) {
// markers.Add(marker);
// /// <summary> }
// /// Note that the XPathDocument.SelectNodes call returns a bad XPathNode set
// /// back. It finds a namespace node at 0, 0, even though it uses one based Assert.AreEqual(0, markers.Count);
// /// line information, it should really return false from HasLineInfo, but it Assert.AreEqual(1, nodes.Length);
// /// does not. In our XPathNodeMatch we return false from HasLineInfo. }
// /// </summary>
// [Test] /// <summary>
// public void NamespaceQuery() /// Note that the XPathDocument.SelectNodes call returns a bad XPathNode set
// { /// back. It finds a namespace node at 0, 0, even though it uses one based
// string xml = "<?xml version='1.0'?>\r\n" + /// line information, it should really return false from HasLineInfo, but it
// "<Xml1></Xml1>"; /// does not. In our XPathNodeMatch we return false from HasLineInfo.
// XPathNodeMatch[] nodes = XmlView.SelectNodes(xml, "//namespace::*"); /// </summary>
// [Test]
// IDocument doc = MockDocument.Create(); public void NamespaceQuery()
// doc.TextContent = xml; {
// MarkerStrategy markerStrategy = new MarkerStrategy(doc); string xml = "<?xml version='1.0'?>\r\n" +
// XPathNodeTextMarker.AddMarkers(, nodes); "<Xml1></Xml1>";
// XPathNodeMatch[] nodes = XmlView.SelectNodes(xml, "//namespace::*");
// List<TextMarker> markers = new List<TextMarker>();
// foreach (TextMarker marker in markerStrategy.TextMarker) { ServiceContainer container = new ServiceContainer();
// markers.Add(marker); container.AddService(typeof(MockTextMarkerService), new MockTextMarkerService());
// }
// Assert.AreEqual(0, markers.Count); AvalonEditDocumentAdapter doc = new AvalonEditDocumentAdapter(container);
// Assert.AreEqual(1, nodes.Length); doc.Text = xml;
// } XPathNodeTextMarker.AddMarkers(doc, nodes);
ITextMarkerService service = doc.GetService(typeof(MockTextMarkerService)) as ITextMarkerService;
List<ITextMarker> markers = new List<ITextMarker>();
foreach (ITextMarker marker in service.TextMarkers) {
markers.Add(marker);
}
Assert.AreEqual(0, markers.Count);
Assert.AreEqual(1, nodes.Length);
}
} }
} }

18
src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj

@ -37,16 +37,28 @@
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core"> <Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference> </Reference>
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions"> <Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference> </Reference>
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Presentation">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="nunit.framework"> <Reference Include="nunit.framework">
<HintPath>..\..\..\..\Tools\NUnit\nunit.framework.dll</HintPath> <HintPath>..\..\..\..\Tools\NUnit\nunit.framework.dll</HintPath>
@ -55,6 +67,9 @@
<Reference Include="System.Xml.Linq"> <Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference> </Reference>
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AssemblyInfo.cs" /> <Compile Include="AssemblyInfo.cs" />
@ -114,6 +129,8 @@
<Compile Include="Utils\DerivedXmlTreeViewContainerControl.cs" /> <Compile Include="Utils\DerivedXmlTreeViewContainerControl.cs" />
<Compile Include="Utils\MockAddXmlNodeDialog.cs" /> <Compile Include="Utils\MockAddXmlNodeDialog.cs" />
<Compile Include="Utils\MockOpenedFile.cs" /> <Compile Include="Utils\MockOpenedFile.cs" />
<Compile Include="Utils\MockTextMarkerService.cs" />
<Compile Include="Utils\MockTextMarker.cs" />
<Compile Include="Utils\MockXmlViewContent.cs" /> <Compile Include="Utils\MockXmlViewContent.cs" />
<Compile Include="Utils\ResourceManager.cs" /> <Compile Include="Utils\ResourceManager.cs" />
<Compile Include="Schema\XhtmlStrictSchemaTestFixture.cs" /> <Compile Include="Schema\XhtmlStrictSchemaTestFixture.cs" />
@ -147,7 +164,6 @@
<Compile Include="XPathQuery\XPathResultsListViewColumnWidthsTestFixture.cs" /> <Compile Include="XPathQuery\XPathResultsListViewColumnWidthsTestFixture.cs" />
<Compile Include="XPathQuery\XPathQueryHistoryTestFixture.cs" /> <Compile Include="XPathQuery\XPathQueryHistoryTestFixture.cs" />
<Compile Include="XPathQuery\XPathNodeTextMarkerTests.cs" /> <Compile Include="XPathQuery\XPathNodeTextMarkerTests.cs" />
<Compile Include="Utils\MockDocument.cs" />
<Compile Include="Parser\ActiveElementUnderCursorTests.cs" /> <Compile Include="Parser\ActiveElementUnderCursorTests.cs" />
<Compile Include="Parser\AttributeNameUnderCursorTests.cs" /> <Compile Include="Parser\AttributeNameUnderCursorTests.cs" />
<Compile Include="Schema\FindAttributeFromComplexTypeTestFixture.cs" /> <Compile Include="Schema\FindAttributeFromComplexTypeTestFixture.cs" />

9
src/Main/Base/Project/Src/Editor/AvalonEdit/AvalonEditDocumentAdapter.cs

@ -41,6 +41,15 @@ namespace ICSharpCode.SharpDevelop.Editor
this.document = new TextDocument(); this.document = new TextDocument();
} }
/// <summary>
/// Used in Unit Tests
/// </summary>
public AvalonEditDocumentAdapter(IServiceProvider parentServiceProvider)
{
this.document = new TextDocument();
this.parentServiceProvider = parentServiceProvider;
}
sealed class LineAdapter : IDocumentLine sealed class LineAdapter : IDocumentLine
{ {
readonly DocumentLine line; readonly DocumentLine line;

Loading…
Cancel
Save