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)
4
using ICSharpCode.SharpDevelop.Tests.Utils;
6
using System.Collections.Generic;
8
using ICSharpCode.CodeCoverage;
9
using ICSharpCode.Core;
10
using ICSharpCode.SharpDevelop.Editor;
11
using NUnit.Framework;
13
namespace ICSharpCode.CodeCoverage.Tests.Highlighting
16
public class CodeCoverageMarkersInvalidEndLineTestFixture
18
List<ITextMarker> markers;
24
string configFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "NCoverAddIn.Tests");
25
PropertyService.InitializeService(configFolder, Path.Combine(configFolder, "data"), "NCoverAddIn.Tests");
26
} catch (Exception) {}
28
IDocument document = MockTextMarkerService.CreateDocumentWithMockService();
29
ITextMarkerService markerStrategy = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService;
30
// Give doc 3 lines (end line seems to be counted as an extra line).
31
document.Text = "abc\r\ndef";
33
string xml = "<Coverage>\r\n" +
34
"\t<Assembly id=\"1\" name=\"XmlEditor.Tests\" module=\"C:\\Projects\\Test\\XmlEditor.Tests\\bin\\XmlEditor.Tests.DLL\" domain=\"test-domain-XmlEditor.Tests.dll\" domainIdx=\"1\" />\r\n" +
35
"\t<Type name=\"XmlEditor.Tests.Schema.SingleElementSchemaTestFixture\" asmref=\"1\">\r\n" +
36
"\t\t<Method name=\"GetSchema\">\r\n" +
37
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"3\" sc=\"3\" el=\"4\" ec=\"4\" />\r\n" +
38
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"4\" el=\"5\" ec=\"20\" />\r\n" +
39
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"4\" el=\"-1\" ec=\"20\" />\r\n" +
40
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"4\" el=\"0\" ec=\"20\" />\r\n" +
45
CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml));
46
CodeCoverageMethod method = results.Modules[0].Methods[0];
47
CodeCoverageHighlighter highlighter = new CodeCoverageHighlighter();
48
highlighter.AddMarkers(document, method.SequencePoints);
50
markers = new List<ITextMarker>();
51
foreach (ITextMarker marker in markerStrategy.TextMarkers) {
57
public void NoMarkersAdded()
59
Assert.AreEqual(0, markers.Count,
60
"Should not be any markers added since all sequence point end lines are invalid.");