~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/DisplayBindings/XmlEditor/Test/Schema/AttributeAnnotationTestFixture.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
 
6
using ICSharpCode.XmlEditor;
 
7
using NUnit.Framework;
 
8
 
 
9
namespace 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
                XmlCompletionItemCollection fooAttributeCompletionData;
 
19
                XmlCompletionItemCollection barAttributeCompletionData;
 
20
                
 
21
                public override void FixtureInit()
 
22
                {                       
 
23
                        XmlElementPath path = new XmlElementPath();
 
24
                        path.AddElement(new QualifiedName("foo", "http://foo.com"));
 
25
                        
 
26
                        fooAttributeCompletionData = SchemaCompletion.GetAttributeCompletion(path);
 
27
 
 
28
                        path.AddElement(new QualifiedName("bar", "http://foo.com"));
 
29
                        barAttributeCompletionData = SchemaCompletion.GetAttributeCompletion(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
}