~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.XmlEditor/Tests/Schema/ElementRefAnnotationTestFixture.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
using MonoDevelop.Ide.CodeCompletion;
 
3
using MonoDevelop.XmlEditor;
 
4
using NUnit.Framework;
 
5
using System;
 
6
using System.IO;
 
7
using System.Xml;
 
8
 
 
9
namespace MonoDevelop.XmlEditor.Tests.Schema
 
10
{
 
11
        /// <summary>
 
12
        /// Tests that the completion data retrieves the annotation documentation
 
13
        /// that an element ref may have.
 
14
        /// </summary>
 
15
        [TestFixture]
 
16
        public class ElementRefAnnotationTestFixture : SchemaTestFixtureBase
 
17
        {
 
18
                ICompletionData[] fooChildElementCompletionData;
 
19
                
 
20
                public override void FixtureInit()
 
21
                {
 
22
                        XmlElementPath path = new XmlElementPath();
 
23
                        path.Elements.Add(new QualifiedName("foo", "http://foo.com"));
 
24
                        
 
25
                        fooChildElementCompletionData = SchemaCompletionData.GetChildElementCompletionData(path);
 
26
                }
 
27
                                
 
28
                [Test]
 
29
                public void BarElementDocumentation()
 
30
                {
 
31
                        Assert.IsTrue(SchemaTestFixtureBase.ContainsDescription(fooChildElementCompletionData, "bar", "Documentation for bar element."),
 
32
                                      "Missing documentation for bar element");
 
33
                }
 
34
                
 
35
                protected override string GetSchema()
 
36
                {
 
37
                        return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://foo.com\" xmlns=\"http://foo.com\">\r\n" +
 
38
                                "\t<xs:element name=\"foo\">\r\n" +
 
39
                                "\t\t<xs:complexType>\r\n" +
 
40
                                "\t\t\t<xs:sequence>\r\n" +
 
41
                                "\t\t\t\t<xs:element ref=\"bar\"/>\r\n" +
 
42
                                "\t\t\t</xs:sequence>\r\n" +
 
43
                                "\t\t</xs:complexType>\r\n" +
 
44
                                "\t</xs:element>\r\n" +
 
45
                                "\r\n" +
 
46
                                "\t<xs:element name=\"bar\">\r\n" +
 
47
                                "\t\t<xs:annotation>\r\n" +
 
48
                                "\t\t\t<xs:documentation>Documentation for bar element.</xs:documentation>\r\n" +
 
49
                                "\t\t</xs:annotation>\r\n" +
 
50
                                "\t\t<xs:complexType>\r\n" +
 
51
                                "\t\t\t<xs:attribute name=\"id\"/>\r\n" +
 
52
                                "\t\t</xs:complexType>\r\n" +
 
53
                                "\t</xs:element>\r\n" +
 
54
                                "</xs:schema>";
 
55
                }               
 
56
        }
 
57
}