public void ShowResults(CodeCoverageResults results) { if (results != null) { codeCoverageControl.AddModules(results.Modules); } }
public void Init() { try { string configFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "NCoverAddIn.Tests"); PropertyService.InitializeService(configFolder, Path.Combine(configFolder, "data"), "NCoverAddIn.Tests"); } catch (Exception) {} IDocument document = MockDocument.Create(); // Give doc 3 lines (end line seems to be counted as an extra line). document.TextContent = "abc\r\ndef"; MarkerStrategy markerStrategy = new MarkerStrategy(document); string xml = "<Coverage>\r\n" + "\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" + "\t<Type name=\"XmlEditor.Tests.Schema.SingleElementSchemaTestFixture\" asmref=\"1\">\r\n" + "\t\t<Method name=\"GetSchema\">\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"3\" sc=\"3\" el=\"4\" ec=\"4\" />\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"4\" el=\"5\" ec=\"20\" />\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"4\" el=\"-1\" ec=\"20\" />\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"4\" el=\"0\" ec=\"20\" />\r\n" + "\t\t</Method>\r\n" + "\t</Type>\r\n" + "</Coverage>"; CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml)); CodeCoverageMethod method = results.Modules[0].Methods[0]; CodeCoverageHighlighter highlighter = new CodeCoverageHighlighter(); highlighter.AddMarkers(markerStrategy, method.SequencePoints); markers = new List<CodeCoverageTextMarker>(); foreach (CodeCoverageTextMarker marker in markerStrategy.TextMarker) { markers.Add(marker); } }
public void SetUpFixture() { try { string configFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "NCoverAddIn.Tests"); PropertyService.InitializeService(configFolder, Path.Combine(configFolder, "data"), "NCoverAddIn.Tests"); } catch (Exception) {} document = MockTextMarkerService.CreateDocumentWithMockService(); string code = "\t\t{\r\n" + "\t\t\treturn \"<?xml version=\\\"1.0\\\"?>\\r\\n\" +\r\n" + "\t\t\t\t\"<xs:schema xmlns:xs=\\\"http://www.w3.org/2001/XMLSchema\\\"\\r\\n\" +\r\n" + "\t\t\t\t\"targetNamespace=\\\"http://www.w3schools.com\\\"\\r\\n\" +\r\n" + "\t\t\t\t\"xmlns=\\\"http://www.w3schools.com\\\"\\r\\n\" +\r\n" + "\t\t\t\t\"elementFormDefault=\\\"qualified\\\">\\r\\n\" +\r\n" + "\t\t\t\t\"<xs:element name=\\\"note\\\">\\r\\n\" +\r\n" + "\t\t\t\t\"</xs:element>\\r\\n\" +\r\n" + "\t\t\t\t\"</xs:schema>\";\r\n" + "\t\t}\r\n"; document.Text = code; ITextMarkerService markerStrategy = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService; string xml = "<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" + "\t<Modules>\r\n" + "\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" + "\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" + "\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" + "\t\t\t<Files>\r\n" + "\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + "\t\t\t</Files>\r\n" + "\t\t\t<Classes>\r\n" + "\t\t\t\t<Class>\r\n" + "\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" + "\t\t\t\t\t<Methods>\r\n" + "\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" + "\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" + "\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::SimpleTest()</Name>\r\n" + "\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" + "\t\t\t\t\t\t\t<SequencePoints>\r\n" + "\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"4\" />\r\n" + "\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"2\" sc=\"4\" el=\"9\" ec=\"20\" />\r\n" + "\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"10\" sc=\"3\" el=\"10\" ec=\"4\" />\r\n" + "\t\t\t\t\t\t\t</SequencePoints>\r\n" + "\t\t\t\t\t\t</Method>\r\n" + "\t\t\t\t\t</Methods>\r\n" + "\t\t\t\t</Class>\r\n" + "\t\t\t</Classes>\r\n" + "\t\t</Module>\r\n" + "\t</Modules>\r\n" + "</CoverageSession>"; CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml)); CodeCoverageMethod method = results.Modules[0].Methods[0]; CodeCoverageHighlighter highlighter = new CodeCoverageHighlighter(); highlighter.AddMarkers(document, method.SequencePoints); markers = new List<ITextMarker>(); foreach (ITextMarker marker in markerStrategy.TextMarkers) { markers.Add(marker); } }
/// <summary>Create Method Element</summary> /// <param name="element">XMLElement</param> /// <param name="results">has .GetFileName(FileID)</param> public CodeCoverageMethodElement(XElement element, CodeCoverageResults results) { this.results = results; this.element = element; this.SequencePoints = new List<CodeCoverageSequencePoint>(); Init(); }
public void Init() { try { string configFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "NCoverAddIn.Tests"); PropertyService.InitializeService(configFolder, Path.Combine(configFolder, "data"), "NCoverAddIn.Tests"); } catch (Exception) {} IDocument document = MockTextMarkerService.CreateDocumentWithMockService(); ITextMarkerService markerStrategy = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService; string xml = "<PartCoverReport>\r\n" + "\t<File id=\"1\" url=\"c:\\Projects\\XmlEditor\\Test\\Schema\\SingleElementSchemaTestFixture.cs\"/>\r\n" + "\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" + "\t<Type name=\"XmlEditor.Tests.Schema.SingleElementSchemaTestFixture\" asmref=\"1\">\r\n" + "\t\t<Method name=\"GetSchema\">\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"0\" sc=\"3\" el=\"0\" ec=\"4\" />\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"-1\" sc=\"4\" el=\"9\" ec=\"20\" />\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"10\" sc=\"3\" el=\"10\" ec=\"4\" />\r\n" + "\t\t</Method>\r\n" + "\t</Type>\r\n" + "</PartCoverReport>"; CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml)); CodeCoverageMethod method = results.Modules[0].Methods[0]; CodeCoverageHighlighter highlighter = new CodeCoverageHighlighter(); highlighter.AddMarkers(document, method.SequencePoints); markers = new List<ITextMarker>(); foreach (ITextMarker marker in markerStrategy.TextMarkers) { markers.Add(marker); } }
public void SetUpTestFixture() { try { string configFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "NCoverAddIn.Tests"); PropertyService.InitializeService(configFolder, Path.Combine(configFolder, "data"), "NCoverAddIn.Tests"); } catch (Exception) {} IDocument document = MockDocument.Create(); string code = "\t\t{\r\n" + "\t\t\tint count = 0;\r\n" + "\t\t}\r\n"; document.TextContent = code; markerStrategy = new MarkerStrategy(document); string xml = "<PartCoverReport>\r\n" + "\t<File id=\"1\" url=\"c:\\Projects\\Foo\\FooTestFixture.cs\"/>\r\n" + "\t<Assembly id=\"1\" name=\"Foo.Tests\" module=\"C:\\Projects\\Test\\bin\\Foo.Tests.DLL\" domain=\"test-domain-Foo.Tests.dll\" domainIdx=\"1\" />\r\n" + "\t<Type name=\"Foo.Tests.FooTestFixture\" asmref=\"1\">\r\n" + "\t\t<Method name=\"SimpleTest\">\r\n" + "\t\t\t<pt visit=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"4\" fid=\"1\" />\r\n" + "\t\t\t<pt visit=\"1\" sl=\"2\" sc=\"4\" el=\"2\" ec=\"18\" fid=\"1\" />\r\n" + "\t\t\t<pt visit=\"0\" sl=\"3\" sc=\"3\" el=\"3\" ec=\"4\" fid=\"1\" />\r\n" + "\t\t</Method>\r\n" + "\t</Type>\r\n" + "</PartCoverReport>"; CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml)); CodeCoverageMethod method = results.Modules[0].Methods[0]; CodeCoverageHighlighter highlighter = new CodeCoverageHighlighter(); highlighter.AddMarkers(markerStrategy, method.SequencePoints); // Add non-code coverage markers. markerStrategy.AddMarker(new TextMarker(0, 2, TextMarkerType.Underlined)); markerStrategy.AddMarker(new TextMarker(4, 5, TextMarkerType.Underlined)); }
public void SetUpFixture() { string xml = "<PartCoverReport date=\"2008-07-10T02:59:13.7198656+01:00\">\r\n" + " <File id=\"1\" url=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + " <Assembly id=\"1\" name=\"Foo.Tests\" module=\"C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL\" domain=\"test-domain-Foo.Tests.dll\" domainIdx=\"1\" />\r\n" + " <Type asmref=\"1\" name=\"Foo.Tests.FooTestFixture\" flags=\"1232592\">\r\n" + " <Method name=\"SimpleTest\" sig=\"void ()\" bodysize=\"42\" flags=\"2182\" iflags=\"0\">\r\n" + " <pt visit=\"1\" pos=\"0\" len=\"1\" fid=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" + " <pt visit=\"1\" pos=\"0\" len=\"1\" fid=\"1\" sl=\"21\" sc=\"13\" el=\"21\" ec=\"32\" />\r\n" + " <pt visit=\"0\" pos=\"0\" len=\"1\" fid=\"1\" sl=\"24\" sc=\"3\" el=\"24\" ec=\"4\" />\r\n" + " </Method>\r\n" + " </Type>\r\n" + "</PartCoverReport>"; results = new CodeCoverageResults(new StringReader(xml)); if (results.Modules.Count > 0) { module = results.Modules[0]; if (module.Methods.Count > 0) { method = module.Methods[0]; if (method.SequencePoints.Count == 3) { point1 = method.SequencePoints[0]; point2 = method.SequencePoints[1]; point3 = method.SequencePoints[2]; } } } }
public void SetUpFixture() { string xml = "<PartCoverReport>\r\n" + "\t<File id=\"1\" url=\"c:\\Projects\\Foo\\FooTestFixture.cs\"/>\r\n" + "\t<File id=\"2\" url=\"c:\\Projects\\Foo\\FooTestFixture2.cs\"/>\r\n" + "\t<File id=\"3\" url=\"c:\\Projects\\Foo\\BarTestFixture.cs\"/>\r\n" + "\t<Assembly id=\"1\" name=\"Foo.Tests\" module=\"C:\\Projects\\Test\\bin\\Foo.Tests.DLL\" domain=\"test-domain-Foo.Tests.dll\" domainIdx=\"1\" />\r\n" + "\t<Assembly id=\"2\" name=\"Bar.Tests\" module=\"C:\\Projects\\Test\\bin\\Bar.Tests.DLL\" domain=\"test-domain-Bar.Tests.dll\" domainIdx=\"1\" />\r\n" + "\t<Type name=\"Foo.Tests.FooTestFixture1\" asmref=\"1\">\r\n" + "\t\t<Method name=\"SimpleTest1\">\r\n" + "\t\t\t<pt visit=\"12\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"1\" />\r\n" + "\t\t\t<pt visit=\"4\" sl=\"21\" sc=\"13\" el=\"21\" ec=\"32\" fid=\"1\" />\r\n" + "\t\t\t<pt visit=\"0\" sl=\"24\" sc=\"3\" el=\"24\" ec=\"4\" fid=\"1\"/>\r\n" + "\t\t</Method>\r\n" + "\t</Type>\r\n" + "\t<Type name=\"Foo.Tests.FooTestFixture2\" asmref=\"1\">\r\n" + "\t\t<Method name=\"SimpleTest2\">\r\n" + "\t\t\t<pt visit=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"2\" />\r\n" + "\t\t\t<pt visit=\"10\" sl=\"21\" sc=\"13\" el=\"21\" ec=\"32\" fid=\"2\"/>\r\n" + "\t\t\t<pt visit=\"0\" sl=\"24\" sc=\"3\" el=\"24\" ec=\"4\" fid=\"2\" />\r\n" + "\t\t</Method>\r\n" + "\t</Type>\r\n" + "\t<Type name=\"Bar.Tests.FooTestFixture3\" asmref=\"2\">\r\n" + "\t\t<Method name=\"SimpleTest3\">\r\n" + "\t\t\t<pt visit=\"5\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"3\" />\r\n" + "\t\t\t<pt visit=\"1\" sl=\"21\" sc=\"13\" el=\"21\" ec=\"32\" fid=\"3\" />\r\n" + "\t\t\t<pt visit=\"0\" sl=\"24\" sc=\"3\" el=\"24\" ec=\"4\" fid=\"3\" />\r\n" + "\t\t</Method>\r\n" + "\t</Type>\r\n" + "</PartCoverReport>"; results = new CodeCoverageResults(new StringReader(xml)); fooModule = results.Modules[0]; barModule = results.Modules[1]; }
/// <summary>Create Method Element</summary> /// <param name="element">XMLElement</param> /// <param name="results">has .GetFileName(FileID)</param> public CodeCoverageMethodElement(XElement element, CodeCoverageResults results) { this.results = results; this.element = element; this.SequencePoints = new List <CodeCoverageSequencePoint>(); Init(); }
public void SetUpFixture() { string xml = "<PartCoverReport ver=\"1.0.2796.35184\">\r\n" + "<File id=\"1\" url=\"c:\\test\\MyTests\\Class1.cs\" />\r\n" + "<Assembly id=\"1\" name=\"MyTests.Tests\" module=\"C:\\Projects\\Test\\MyTests\\bin\\MyTests.DLL\" domain=\"test-domain-MyTests.dll\" domainIdx=\"1\" />\r\n" + "<Assembly id=\"2\" name=\"nunit.framework\" module=\"C:\\Projects\\Test\\MyTests\\bin\\nunit.framework.DLL\" domain=\"test-domain-nunit.framework.dll\" domainIdx=\"1\" />\r\n" + "<Type asmref=\"2\" name=\"NUnit.Framework.NotEqualAsserter\" flags=\"1233408\">\r\n" + " <Method name=\"Fail\" sig=\"bool ()\" flags=\"134\" iflags=\"0\">\r\n" + " <pt visit=\"1\" pos=\"11\" len=\"1\" />\r\n" + " <pt visit=\"0\" pos=\"6\" len=\"5\" />\r\n" + " <pt visit=\"0\" pos=\"0\" len=\"6\" />\r\n" + " </Method>\r\n" + "</Type>\r\n" + "<Type asmref=\"1\" name=\"MyClass\" flags=\"1233248\">\r\n" + " <Method name=\".ctor\" sig=\"void ()\" flags=\"6278\" iflags=\"0\">\r\n" + " <pt visit=\"0\" pos=\"8\" len=\"2\" fid=\"1\" sl=\"21\" sc=\"3\" el=\"21\" ec=\"4\" />\r\n" + " <pt visit=\"0\" pos=\"7\" len=\"1\" fid=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" + " <pt visit=\"0\" pos=\"0\" len=\"7\" fid=\"1\" sl=\"19\" sc=\"3\" el=\"19\" ec=\"18\" />\r\n" + " <pt visit=\"0\" pos=\"0\" len=\"7\" sl=\"19\" sc=\"3\" el=\"19\" ec=\"18\" />\r\n" + " </Method>\r\n" + "</Type>\r\n" + "</PartCoverReport>"; results = new CodeCoverageResults(new StringReader(xml)); }
public CodeCoverageMethodElement(XElement element, CodeCoverageResults parent) { this.parent = parent; this.element = element; this.SequencePoints = new List<CodeCoverageSequencePoint>(); this.BranchPoints = new List<CodeCoverageBranchPoint>(); Init(); }
/// <summary> /// Shows the code coverage results in the code coverage pad and /// highlights any source code files that have been profiled. /// </summary> public static void ShowResults(CodeCoverageResults results) { CodeCoverageService.results.Add(results); CodeCoveragePad pad = CodeCoveragePad.Instance; if (pad != null) { pad.ShowResults(results); } RefreshCodeCoverageHighlights(); }
//从解决方案中获得工程 public IEnumerable <CodeCoverageResults> GetCodeCoverageResultsForAllProjects() { foreach (IProject project in solution.Projects) { CodeCoverageResults results = GetCodeCoverageResultsForProject(project); if (results != null) { yield return(results); } } }
public void SetUpFixture() { IDocument document = MockTextMarkerService.CreateDocumentWithMockService(); ITextMarkerService markerStrategy = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService; string code = "\t\t{\r\n" + "\t\t\tAssert.AreEqual(0, childElementCompletionData.Length, \"\" +\r\n" + "\t\t\t \"Not expecting any child elements.\");\r\n" + "\t\t}\r\n"; document.Text = code; string xml = "<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" + "\t<Modules>\r\n" + "\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" + "\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" + "\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" + "\t\t\t<Files>\r\n" + "\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + "\t\t\t</Files>\r\n" + "\t\t\t<Classes>\r\n" + "\t\t\t\t<Class>\r\n" + "\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" + "\t\t\t\t\t<Methods>\r\n" + "\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" + "\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" + "\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::SimpleTest()</Name>\r\n" + "\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" + "\t\t\t\t\t\t\t<SequencePoints>\r\n" + "\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"4\" />\r\n" + "\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"2\" sc=\"4\" el=\"3\" ec=\"57\" />\r\n" + "\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"4\" sc=\"3\" el=\"4\" ec=\"4\" />\r\n" + "\t\t\t\t\t\t\t</SequencePoints>\r\n" + "\t\t\t\t\t\t</Method>\r\n" + "\t\t\t\t\t</Methods>\r\n" + "\t\t\t\t</Class>\r\n" + "\t\t\t</Classes>\r\n" + "\t\t</Module>\r\n" + "\t</Modules>\r\n" + "</CoverageSession>"; CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml)); CodeCoverageMethod method = results.Modules[0].Methods[0]; CodeCoverageHighlighter highlighter = new CodeCoverageHighlighter(); highlighter.AddMarkers(document, method.SequencePoints); foreach (ITextMarker marker in markerStrategy.TextMarkers) { if (markerOne == null) { markerOne = marker; } else if (markerTwo == null) { markerTwo = marker; } else if (markerThree == null) { markerThree = marker; } } }
void CodeCoverageRunFinished(object source, EventArgs e) { if (codeCoverageTestRunner.HasCodeCoverageResults()) { CodeCoverageResults results = codeCoverageTestRunner.ReadCodeCoverageResults(); DisplayCodeCoverageResults(results); } else { DisplayNoCodeCoverageResultsGeneratedMessage(); } }
public void Init() { try { //string configFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "NCoverAddIn.Tests"); //PropertyService.InitializeService(configFolder, Path.Combine(configFolder, "data"), "NCoverAddIn.Tests"); } catch (Exception) {} IDocument document = MockTextMarkerService.CreateDocumentWithMockService(); ITextMarkerService markerStrategy = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService; // Give doc 3 lines (end line seems to be counted as an extra line). document.Text = "abc\r\ndef"; string xml = "<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" + "\t<Modules>\r\n" + "\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" + "\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" + "\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" + "\t\t\t<Files>\r\n" + "\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + "\t\t\t</Files>\r\n" + "\t\t\t<Classes>\r\n" + "\t\t\t\t<Class>\r\n" + "\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" + "\t\t\t\t\t<Methods>\r\n" + "\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" + "\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" + "\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::SimpleTest()</Name>\r\n" + "\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" + "\t\t\t\t\t\t\t<SequencePoints>\r\n" + "\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"3\" sc=\"3\" el=\"4\" ec=\"4\" />\r\n" + "\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"4\" el=\"5\" ec=\"20\" />\r\n" + "\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"4\" el=\"-1\" ec=\"20\" />\r\n" + "\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"4\" el=\"0\" ec=\"20\" />\r\n" + "\t\t\t\t\t\t\t</SequencePoints>\r\n" + "\t\t\t\t\t\t</Method>\r\n" + "\t\t\t\t\t</Methods>\r\n" + "\t\t\t\t</Class>\r\n" + "\t\t\t</Classes>\r\n" + "\t\t</Module>\r\n" + "\t</Modules>\r\n" + "</CoverageSession>"; CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml)); CodeCoverageMethod method = results.Modules[0].Methods[0]; CodeCoverageHighlighter highlighter = new CodeCoverageHighlighter(); highlighter.AddMarkers(document, method.SequencePoints); markers = new List<ITextMarker>(); foreach (ITextMarker marker in markerStrategy.TextMarkers) { markers.Add(marker); } }
void DisplayCoverageResults(string fileName) { if (!File.Exists(fileName)) { Task task = new Task(String.Empty, String.Concat(StringParser.Parse("${res:ICSharpCode.CodeCoverage.NoCodeCoverageResultsGenerated}"), " ", fileName), 0, 0, TaskType.Error); WorkbenchSingleton.SafeThreadAsyncCall(TaskService.Add, task); return; } CodeCoverageResults results = new CodeCoverageResults(fileName); WorkbenchSingleton.SafeThreadAsyncCall(CodeCoverageService.ShowResults, results); }
public void SetUpFixture() { string xml = "<PartCoverReport date=\"2008-07-10T02:59:13.7198656+01:00\">\r\n" + " <File id=\"1\" url=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + " <Assembly id=\"1\" name=\"Foo.Tests\" module=\"C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL\" domain=\"test-domain-Foo.Tests.dll\" domainIdx=\"1\" />\r\n" + " <Type asmref=\"1\" name=\"Foo.Tests.FooTestFixture\" flags=\"1232592\">\r\n" + " <Method name=\"SimpleTest\" sig=\"void ()\" bodysize=\"42\" flags=\"2182\" iflags=\"0\" />\r\n" + " </Type>\r\n" + "</PartCoverReport>"; results = new CodeCoverageResults(new StringReader(xml)); if (results.Modules.Count > 0) { module = results.Modules[0]; } }
public void SetUpFixture() { string xml = "<PartCoverReport ver=\"1.0.2796.35184\">\r\n" + " <File id=\"1\" url=\"d:\\Projects\\test\\TestFixture1.cs\" />\r\n" + " <Assembly id=\"1\" name=\"MyTests\" module=\"C:\\Projects\\Test\\MyTests\\bin\\MyTests.DLL\" domain=\"test-domain-MyTests.dll\" domainIdx=\"1\" />\r\n" + " <Type asmref=\"1\" name=\"MyTests.Class1\" flags=\"2606412\">\r\n" + " <Method name=\"set_Count\" sig=\"void (int)\" flags=\"2182\" iflags=\"0\">\r\n" + " <pt visit=\"0\" pos=\"9\" len=\"1\" fid=\"1\" sl=\"34\" sc=\"4\" el=\"34\" ec=\"5\" />\r\n" + " <pt visit=\"0\" pos=\"1\" len=\"8\" fid=\"1\" sl=\"33\" sc=\"5\" el=\"33\" ec=\"12\" />\r\n" + " <pt visit=\"0\" pos=\"0\" len=\"1\" fid=\"1\" sl=\"32\" sc=\"8\" el=\"32\" ec=\"9\" />\r\n" + " </Method>\r\n" + " <Method name=\"get_Count\" sig=\"int ()\" flags=\"2182\" iflags=\"0\">\r\n" + " <pt visit=\"0\" pos=\"6\" len=\"2\" fid=\"1\" sl=\"31\" sc=\"4\" el=\"31\" ec=\"5\" />\r\n" + " <pt visit=\"0\" pos=\"1\" len=\"5\" fid=\"1\" sl=\"30\" sc=\"5\" el=\"30\" ec=\"15\" />\r\n" + " <pt visit=\"0\" pos=\"0\" len=\"1\" fid=\"1\" sl=\"29\" sc=\"8\" el=\"29\" ec=\"9\" />\r\n" + " </Method>\r\n" + " <Method name=\"get_NotAProperty\" sig=\"void ()\" flags=\"134\" iflags=\"0\">\r\n" + " <pt visit=\"0\" pos=\"1\" len=\"1\" fid=\"1\" sl=\"26\" sc=\"3\" el=\"26\" ec=\"4\" />\r\n" + " <pt visit=\"0\" pos=\"0\" len=\"1\" fid=\"1\" sl=\"25\" sc=\"3\" el=\"25\" ec=\"4\" />\r\n" + " </Method>\r\n" + " <Method name=\"PropertyFlagsButJustAMethod\" sig=\"void ()\" flags=\"2182\" iflags=\"0\">\r\n" + " <pt visit=\"0\" pos=\"8\" len=\"2\" fid=\"1\" sl=\"22\" sc=\"3\" el=\"22\" ec=\"4\" />\r\n" + " <pt visit=\"0\" pos=\"7\" len=\"1\" fid=\"1\" sl=\"21\" sc=\"3\" el=\"21\" ec=\"4\" />\r\n" + " <pt visit=\"0\" pos=\"0\" len=\"7\" fid=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"18\" />\r\n" + " </Method>\r\n" + " <Method name=\"InvalidFlags\" sig=\"void ()\" flags=\"\" iflags=\"0\">\r\n" + " <pt visit=\"0\" pos=\"8\" len=\"2\" fid=\"1\" sl=\"22\" sc=\"3\" el=\"22\" ec=\"4\" />\r\n" + " <pt visit=\"0\" pos=\"7\" len=\"1\" fid=\"1\" sl=\"21\" sc=\"3\" el=\"21\" ec=\"4\" />\r\n" + " <pt visit=\"0\" pos=\"0\" len=\"7\" fid=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"18\" />\r\n" + " </Method>\r\n" + " </Type>\r\n" + "</PartCoverReport>"; results = new CodeCoverageResults(new StringReader(xml)); if (results.Modules.Count > 0) { CodeCoverageModule module = results.Modules[0]; if (module.Methods.Count > 2) { setterMethod = module.Methods[0]; getterMethod = module.Methods[1]; method = module.Methods[2]; methodWithPropertyFlagsButInvalidName = module.Methods[3]; } } }
public void SetUpFixture() { try { string configFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "NCoverAddIn.Tests"); PropertyService.InitializeService(configFolder, Path.Combine(configFolder, "data"), "NCoverAddIn.Tests"); } catch (Exception) {} IDocument document = MockDocument.Create(); string code = "\t\t{\r\n" + "\t\t\tAssert.AreEqual(0, childElementCompletionData.Length, \"\" +\r\n" + "\t\t\t \"Not expecting any child elements.\");\r\n" + "\t\t}\r\n"; document.TextContent = code; MarkerStrategy markerStrategy = new MarkerStrategy(document); string xml = "<PartCoverReport>\r\n" + "\t<file id=\"1\" url=\"c:\\Projects\\XmlEditor\\Test\\Schema\\SingleElementSchemaTestFixture.cs\" />\r\n" + "\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" + "\t<Type asmref=\"1\" name=\"XmlEditor.Tests.Schema.SingleElementSchemaTestFixture\">\r\n" + "\t\t<Method name=\"NoteElementHasNoChildElements\">\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"4\" />\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"2\" sc=\"4\" el=\"3\" ec=\"57\" />\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"4\" sc=\"3\" el=\"4\" ec=\"4\" />\r\n" + "\t\t</Method>\r\n" + "\t</Type>\r\n" + "</PartCoverReport>"; CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml)); CodeCoverageMethod method = results.Modules[0].Methods[0]; CodeCoverageHighlighter highlighter = new CodeCoverageHighlighter(); highlighter.AddMarkers(markerStrategy, method.SequencePoints); foreach (CodeCoverageTextMarker marker in markerStrategy.TextMarker) { if (markerOne == null) { markerOne = marker; } else if (markerTwo == null) { markerTwo = marker; } else if (markerThree == null) { markerThree = marker; } else if (markerFour == null) { markerFour = marker; } } }
public void SetUpFixture() { try { string configFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "NCoverAddIn.Tests"); PropertyService.InitializeService(configFolder, Path.Combine(configFolder, "data"), "NCoverAddIn.Tests"); } catch (Exception) {} IDocument document = MockDocument.Create(); string code = "\t\t{\r\n" + "\t\t\treturn \"<?xml version=\\\"1.0\\\"?>\\r\\n\" +\r\n" + "\t\t\t\t\"<xs:schema xmlns:xs=\\\"http://www.w3.org/2001/XMLSchema\\\"\\r\\n\" +\r\n" + "\t\t\t\t\"targetNamespace=\\\"http://www.w3schools.com\\\"\\r\\n\" +\r\n" + "\t\t\t\t\"xmlns=\\\"http://www.w3schools.com\\\"\\r\\n\" +\r\n" + "\t\t\t\t\"elementFormDefault=\\\"qualified\\\">\\r\\n\" +\r\n" + "\t\t\t\t\"<xs:element name=\\\"note\\\">\\r\\n\" +\r\n" + "\t\t\t\t\"</xs:element>\\r\\n\" +\r\n" + "\t\t\t\t\"</xs:schema>\";\r\n" + "\t\t}\r\n"; document.TextContent = code; MarkerStrategy markerStrategy = new MarkerStrategy(document); string xml = "<PartCoverReport>\r\n" + "\t<File id=\"1\" url=\"c:\\Projects\\XmlEditor\\Test\\Schema\\SingleElementSchemaTestFixture.cs\" />\r\n" + "\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" + "\t<Type asmref=\"XmlEditor.Tests\" name=\"XmlEditor.Tests.Schema.SingleElementSchemaTestFixture\" flags=\"1232592\">\r\n" + "\t\t<Method name=\"GetSchema\">\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"4\" />\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"2\" sc=\"4\" el=\"9\" ec=\"20\" />\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"10\" sc=\"3\" el=\"10\" ec=\"4\" />\r\n" + "\t\t</Method>\r\n" + "\t</Type>\r\n" + "</PartCoverReport>"; CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml)); CodeCoverageMethod method = results.Modules[0].Methods[0]; CodeCoverageHighlighter highlighter = new CodeCoverageHighlighter(); highlighter.AddMarkers(markerStrategy, method.SequencePoints); markers = new List<CodeCoverageTextMarker>(); foreach (CodeCoverageTextMarker marker in markerStrategy.TextMarker) { markers.Add(marker); } }
public void SetUpFixture() { string xml = "<PartCoverReport>\r\n" + "\t<File id=\"1\" url=\"c:\\Projects\\Foo\\SimpleTestFixture.cs\"/>\r\n" + "\t<Assembly id=\"1\" name=\"Foo.Tests\" module=\"C:\\Projects\\Test\\bin\\Foo.Tests.DLL\" domain=\"test-domain-Foo.Tests.dll\" domainIdx=\"1\" />\r\n" + "\t<Type name=\"Foo.Tests.FooTestFixture\" asmref=\"1\">\r\n" + "\t\t<Method name=\"InvalidVisitCount\">\r\n" + "\t\t\t<pt visit=\"a\" fid=\"1\" sl=\"10\" sc=\"3\" el=\"20\" ec=\"4\"/>\r\n" + "\t\t</Method>\r\n" + "\t\t<Method name=\"InvalidLine\">\r\n" + "\t\t\t<pt visit=\"2\" fid=\"1\" sl=\"b\" sc=\"3\" el=\"20\" ec=\"4\"/>\r\n" + "\t\t</Method>\r\n" + "\t\t<Method name=\"InvalidColumn\">\r\n" + "\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"20\" sc=\"c\" el=\"d\" ec=\"e\"/>\r\n" + "\t\t</Method>\r\n" + "\t</Type>\r\n" + "</PartCoverReport>"; results = new CodeCoverageResults(new StringReader(xml)); invalidVisitCountSequencePoint = results.Modules[0].Methods[0].SequencePoints[0]; invalidLineCountSequencePoint = results.Modules[0].Methods[1].SequencePoints[0]; invalidColumnCountSequencePoint = results.Modules[0].Methods[2].SequencePoints[0]; }
public void SetUpFixture() { string xml = "<PartCoverReport>\r\n" + " <File id=\"1\" url=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + " <File id=\"2\" url=\"c:\\Projects\\Foo\\SimpleTestFixture.cs\" />\r\n" + " <File id=\"3\" url=\"c:\\Projects\\Foo\\BarTestFixture.cs\" />\r\n" + " <Assembly id=\"1\" name=\"Foo.Tests\" module=\"C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL\" domain=\"test-domain-Foo.Tests.dll\" domainIdx=\"1\" />\r\n" + " <Assembly id=\"2\" name=\"Bar.Tests\" module=\"C:\\Projects\\Test\\Foo.Tests\\bin\\Bar.Tests.DLL\" domain=\"test-domain-Bar.Tests.dll\" domainIdx=\"1\" />\r\n" + " <Type name=\"Foo.Tests.FooTestFixture\" asmref=\"1\">\r\n" + " <Method name=\"FooTest\">\r\n" + " <pt visit=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"1\" />\r\n" + " </Method>\r\n" + " </Type>\r\n" + " <Type name=\"Foo.Tests.SimpleTestFixture2\" asmref=\"1\">\r\n" + " <Method name=\"SimpleTest2\">\r\n" + " <pt visit=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"2\" />\r\n" + " </Method>\r\n" + " </Type>\r\n" + " <Type name=\"Foo.Tests.SimpleTestFixture3\" asmref=\"1\">\r\n" + " <Method name=\"SimpleTest3\">\r\n" + " <pt visit=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"2\" />\r\n" + " </Method>\r\n" + " </Type>\r\n" + " <Type name=\"Foo.Tests.BarTestFixture\" asmref=\"2\">\r\n" + " <Method name=\"SimpleTest2\">\r\n" + " <pt visit=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"3\" />\r\n" + " </Method>\r\n" + " </Type>\r\n" + "</PartCoverReport>"; results = new CodeCoverageResults(new StringReader(xml)); fooTestFixtureSequencePoints = results.GetSequencePoints(@"c:\Projects\Foo\FooTestFixture.cs"); barTestFixtureSequencePoints = results.GetSequencePoints(@"c:\Projects\Foo\BarTestFixture.cs"); simpleTestFixtureSequencePoints = results.GetSequencePoints(@"c:\Projects\Foo\SimpleTestFixture.cs"); nonExistentFileNameSequencePoints = results.GetSequencePoints(@"c:\Projects\Foo\NoSuchTestFixture.cs"); }
public CodeCoverageMethod(string className, XElement reader, CodeCoverageResults parent) : this(className, new CodeCoverageMethodElement(reader, parent)) { }
public CodeCoverageResults CreateCodeCoverageResults(string xml) { StringReader reader = new StringReader(xml); results = new CodeCoverageResults(reader); return results; }
void DisplayCodeCoverageResults(CodeCoverageResults results) { SD.MainThread.InvokeIfRequired(() => CodeCoverageService.ShowResults(results)); }
void DisplayCodeCoverageResults(CodeCoverageResults results) { Context.Workbench.SafeThreadAsyncCall(CodeCoverageService.ShowResults, results); }