2
using MonoDevelop.Ide.CodeCompletion;
3
using MonoDevelop.XmlEditor;
8
namespace MonoDevelop.XmlEditor.Tests.Schema
11
/// Tests element group refs
14
public class GroupRefTestFixture : SchemaTestFixtureBase
16
ICompletionData[] childElements;
17
ICompletionData[] paraAttributes;
19
public override void FixtureInit()
21
XmlElementPath path = new XmlElementPath();
23
path.Elements.Add(new QualifiedName("html", "http://foo/xhtml"));
24
path.Elements.Add(new QualifiedName("body", "http://foo/xhtml"));
26
childElements = SchemaCompletionData.GetChildElementCompletionData(path);
28
path.Elements.Add(new QualifiedName("p", "http://foo/xhtml"));
29
paraAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
33
public void BodyHasFourChildElements()
35
Assert.AreEqual(4, childElements.Length,
36
"Should be 4 child elements.");
40
public void BodyChildElementForm()
42
Assert.IsTrue(SchemaTestFixtureBase.Contains(childElements, "form"),
43
"Should have a child element called form.");
47
public void BodyChildElementPara()
49
Assert.IsTrue(SchemaTestFixtureBase.Contains(childElements, "p"),
50
"Should have a child element called p.");
54
public void BodyChildElementTest()
56
Assert.IsTrue(SchemaTestFixtureBase.Contains(childElements, "test"),
57
"Should have a child element called test.");
61
public void BodyChildElementId()
63
Assert.IsTrue(SchemaTestFixtureBase.Contains(childElements, "id"),
64
"Should have a child element called id.");
68
public void ParaElementHasIdAttribute()
70
Assert.IsTrue(SchemaTestFixtureBase.Contains(paraAttributes, "id"),
71
"Should have an attribute called id.");
74
protected override string GetSchema()
76
return "<xs:schema version=\"1.0\" xml:lang=\"en\"\r\n" +
77
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
78
" targetNamespace=\"http://foo/xhtml\"\r\n" +
79
" xmlns=\"http://foo/xhtml\"\r\n" +
80
" elementFormDefault=\"qualified\">\r\n" +
82
" <xs:element name=\"html\">\r\n" +
83
" <xs:complexType>\r\n" +
84
" <xs:sequence>\r\n" +
85
" <xs:element ref=\"head\"/>\r\n" +
86
" <xs:element ref=\"body\"/>\r\n" +
87
" </xs:sequence>\r\n" +
88
" </xs:complexType>\r\n" +
89
" </xs:element>\r\n" +
91
" <xs:element name=\"head\" type=\"xs:string\"/>\r\n" +
92
" <xs:element name=\"body\">\r\n" +
93
" <xs:complexType>\r\n" +
94
" <xs:sequence>\r\n" +
95
" <xs:group ref=\"block\"/>\r\n" +
96
" <xs:element name=\"form\"/>\r\n" +
97
" </xs:sequence>\r\n" +
98
" </xs:complexType>\r\n" +
99
" </xs:element>\r\n" +
102
" <xs:group name=\"block\">\r\n" +
104
" <xs:element ref=\"p\"/>\r\n" +
105
" <xs:group ref=\"heading\"/>\r\n" +
106
" </xs:choice>\r\n" +
109
" <xs:element name=\"p\">\r\n" +
110
" <xs:complexType>\r\n" +
111
" <xs:attribute name=\"id\"/>" +
112
" </xs:complexType>\r\n" +
113
" </xs:element>\r\n" +
115
" <xs:group name=\"heading\">\r\n" +
117
" <xs:element name=\"test\"/>\r\n" +
118
" <xs:element name=\"id\"/>\r\n" +
119
" </xs:choice>\r\n" +