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)
5
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
6
using ICSharpCode.XmlEditor;
9
namespace XmlEditor.Tests.Schema
12
/// Tests that the completion data retrieves the annotation documentation
13
/// that an attribute may have.
16
public class AttributeAnnotationTestFixture : SchemaTestFixtureBase
18
XmlCompletionItemCollection fooAttributeCompletionData;
19
XmlCompletionItemCollection barAttributeCompletionData;
21
public override void FixtureInit()
23
XmlElementPath path = new XmlElementPath();
24
path.AddElement(new QualifiedName("foo", "http://foo.com"));
26
fooAttributeCompletionData = SchemaCompletion.GetAttributeCompletion(path);
28
path.AddElement(new QualifiedName("bar", "http://foo.com"));
29
barAttributeCompletionData = SchemaCompletion.GetAttributeCompletion(path);
33
public void FooAttributeDocumentation()
35
Assert.AreEqual("Documentation for foo attribute.", fooAttributeCompletionData[0].Description);
39
public void BarAttributeDocumentation()
41
Assert.AreEqual("Documentation for bar attribute.", barAttributeCompletionData[0].Description);
44
protected override string GetSchema()
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" +