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) {} 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" + "<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" + "\t<Type asmref=\"1\" name=\"Foo.Tests.FooTestFixture\" flags=\"1232592\">\r\n" + "\t\t<Method name=\"SimpleTest\">\r\n" + "\t\t\t<pt visit=\"1\" sl=\"1\" fid=\"1\" sc=\"3\" el=\"1\" ec=\"4\" document=\"c:\\Projects\\Foo\\Foo1TestFixture.cs\" />\r\n" + "\t\t\t<pt visit=\"1\" sl=\"2\" fid=\"1\" sc=\"4\" el=\"2\" ec=\"18\" document=\"c:\\Projects\\Foo\\Foo1TestFixture.cs\" />\r\n" + "\t\t\t<pt visit=\"0\" sl=\"3\" fid=\"1\" sc=\"3\" el=\"3\" ec=\"4\" document=\"c:\\Projects\\Foo\\Foo1TestFixture.cs\" />\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; } } }