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

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.XmlEditor/Tests/Schema/AttributeAnnotationTestFixture.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 attribute may have.
 
14
        /// </summary>
 
15
        [TestFixture]
 
16
        public class AttributeAnnotationTestFixture : SchemaTestFixtureBase
 
17
        {
 
18
                ICompletionData[] fooAttributeCompletionData;
 
19
                ICompletionData[] barAttributeCompletionData;
 
20
                
 
21
                public override void FixtureInit()
 
22
                {                       
 
23
                        XmlElementPath path = new XmlElementPath();
 
24
                        path.Elements.Add(new QualifiedName("foo", "http://foo.com"));
 
25
                        
 
26
                        fooAttributeCompletionData = SchemaCompletionData.GetAttributeCompletionData(path);
 
27
 
 
28
                        path.Elements.Add(new QualifiedName("bar", "http://foo.com"));
 
29
                        barAttributeCompletionData = SchemaCompletionData.GetAttributeCompletionData(path);
 
30
                }
 
31
                                
 
32
                [Test]
 
33
                public void FooAttributeDocumentation()
 
34
                {
 
35
                        Assert.AreEqual("Documentation for foo attribute.", fooAttributeCompletionData[0].Description);
 
36
                }
 
37
                
 
38
                [Test]
 
39
                public void BarAttributeDocumentation()
 
40
                {
 
41
                        Assert.AreEqual("Documentation for bar attribute.", barAttributeCompletionData[0].Description);
 
42
                }
 
43
                
 
44
                protected override string GetSchema()
 
45
                {
 
46
                        return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://foo.com\" xmlns=\"http://foo.com\" elementFormDefault=\"qualified\">\r\n" +
 
47
                                "\t<xs:element name=\"foo\">\r\n" +
 
48
                                "\t\t<xs:complexType>\r\n" +
 
49
                                "\t\t\t<xs:sequence>\t\r\n" +
 
50
                                "\t\t\t\t<xs:element name=\"bar\" type=\"bar\">\r\n" +
 
51
                                "\t\t\t</xs:element>\r\n" +
 
52
                                "\t\t\t</xs:sequence>\r\n" +
 
53
                                "\t\t\t<xs:attribute name=\"id\">\r\n" +
 
54
                                "\t\t\t\t\t<xs:annotation>\r\n" +
 
55
                                "\t\t\t\t\t\t<xs:documentation>Documentation for foo attribute.</xs:documentation>\r\n" +
 
56
                                "\t\t\t\t</xs:annotation>\t\r\n" +
 
57
                                "\t\t\t</xs:attribute>\t\r\n" +
 
58
                                "\t\t</xs:complexType>\r\n" +
 
59
                                "\t</xs:element>\r\n" +
 
60
                                "\t<xs:complexType name=\"bar\">\r\n" +
 
61
                                "\t\t<xs:attribute name=\"name\">\r\n" +
 
62
                                "\t\t\t<xs:annotation>\r\n" +
 
63
                                "\t\t\t\t<xs:documentation>Documentation for bar attribute.</xs:documentation>\r\n" +
 
64
                                "\t\t\t</xs:annotation>\t\r\n" +
 
65
                                "\t\t</xs:attribute>\t\r\n" +
 
66
                                "\t</xs:complexType>\r\n" +
 
67
                                "</xs:schema>";
 
68
                }               
 
69
        }
 
70
}