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);
            }
        }
Пример #2
0
        public void Init()
        {
            IDocument doc = MockTextMarkerService.CreateDocumentWithMockService();

            markerService = doc.GetRequiredService <ITextMarkerService>();

            // Add xpath marker to document.
            doc.Text = "<Test/>";
            XPathNodeTextMarker xpathNodeMarker = new XPathNodeTextMarker(doc);
            XPathNodeMatch      nodeMatch       = new XPathNodeMatch("Test", "<Test/>", 0, 1, XPathNodeType.Element);

            xpathNodeMarker.AddMarker(nodeMatch);

            // Add non text editor provider view to workbench.
            workbench = MockRepository.GenerateStrictMock <IWorkbench>();
            workbench.Stub(w => w.ViewContentCollection).Return(new List <IViewContent>());

            nonTextEditorProviderView = new MockViewContent();
            workbench.ViewContentCollection.Add(nonTextEditorProviderView);

            // Add document to view content.
            textEditorView = new MockTextEditorProviderViewContent();
            textEditorView.MockTextEditor.SetDocument(doc);
            workbench.ViewContentCollection.Add(textEditorView);

            command = new RemoveXPathHighlightingCommand(workbench);
        }
Пример #3
0
 public void Init()
 {
     document      = MockTextMarkerService.CreateDocumentWithMockService();
     markerService = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService;
     document.Text =
         "{\r\n" +
         "    int count = 0;\r\n" +
         "}\r\n";
 }
        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);
            }
        }
Пример #5
0
        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       = 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 = "<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(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;
                }
            }
        }
Пример #6
0
        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\tint count = 0;\r\n" +
                          "\t\t}\r\n";

            document.Text  = code;
            markerStrategy = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService;

            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(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;
                }
            }
        }
        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 = "<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(document, method.SequencePoints);

            markers = new List <ITextMarker>();
            foreach (ITextMarker marker in markerStrategy.TextMarkers)
            {
                markers.Add(marker);
            }
        }
        public void Init()
        {
            string     xml   = "<root><foo/></root>";
            XPathQuery query = new XPathQuery(xml);

            XPathNodeMatch[] nodes = query.FindNodes("//root");

            IDocument doc = MockTextMarkerService.CreateDocumentWithMockService();

            doc.Text = xml;
            XPathNodeTextMarker xpathNodeMarker = new XPathNodeTextMarker(doc);

            xpathNodeMarker.AddMarkers(nodes);

            ITextMarkerService service = doc.GetService(typeof(ITextMarkerService)) as ITextMarkerService;

            markers = new List <ITextMarker>(service.TextMarkers);

            // Remove markers.
            xpathNodeMarker.RemoveMarkers();
            markersAfterRemove = new List <ITextMarker>(service.TextMarkers);

            xpathNodeTextMarker = markers[0];
        }
        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);
            }
        }
Пример #10
0
        public void SetUpFixture()
        {
            base.FixtureSetUp();

            document = MockTextMarkerService.CreateDocumentWithMockService();
            string code = "\t\t{\r\n" +
                          "\t\t\tint count = 0;\r\n" +
                          "\t\t}\r\n";

            document.Text  = code;
            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=\"2\" ec=\"18\" />\r\n" +
                         "\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"3\" sc=\"3\" el=\"3\" 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;
                }
            }
        }
Пример #11
0
        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       = 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;
                }
            }
        }