2
using MonoDevelop.Ide.CodeCompletion;
3
using MonoDevelop.XmlEditor;
8
namespace MonoDevelop.XmlEditor.Tests.Schema
11
/// Tests that autocompletion data is correct for an xml schema containing:
12
/// <![CDATA[ <xs:element name="foo">
13
/// <xs:group ref="myGroup"/>
18
public class GroupRefAsCompositorTestFixture : SchemaTestFixtureBase
20
ICompletionData[] rootChildElements;
21
ICompletionData[] fooAttributes;
23
public override void FixtureInit()
25
XmlElementPath path = new XmlElementPath();
26
path.Elements.Add(new QualifiedName("root", "http://foo"));
28
rootChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
30
path.Elements.Add(new QualifiedName("foo", "http://foo"));
32
fooAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
36
public void RootHasTwoChildElements()
38
Assert.AreEqual(2, rootChildElements.Length,
39
"Should be two child elements.");
43
public void RootChildElementIsFoo()
45
Assert.IsTrue(SchemaTestFixtureBase.Contains(rootChildElements, "foo"),
46
"Should have a child element called foo.");
50
public void RootChildElementIsBar()
52
Assert.IsTrue(SchemaTestFixtureBase.Contains(rootChildElements, "bar"),
53
"Should have a child element called bar.");
57
public void FooElementHasIdAttribute()
59
Assert.IsTrue(SchemaTestFixtureBase.Contains(fooAttributes, "id"),
60
"Should have an attribute called id.");
63
protected override string GetSchema()
65
return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://foo\" xmlns=\"http://foo\" elementFormDefault=\"qualified\">\r\n" +
66
"\t<xs:element name=\"root\">\r\n" +
67
"\t\t<xs:complexType>\r\n" +
68
"\t\t\t<xs:group ref=\"fooGroup\"/>\r\n" +
69
"\t\t</xs:complexType>\r\n" +
70
"\t</xs:element>\r\n" +
71
"\t<xs:group name=\"fooGroup\">\r\n" +
72
"\t\t<xs:choice>\r\n" +
73
"\t\t\t<xs:element name=\"foo\">\r\n" +
74
"\t\t\t\t<xs:complexType>\r\n" +
75
"\t\t\t\t\t<xs:attribute name=\"id\" type=\"xs:string\"/>\r\n" +
76
"\t\t\t\t</xs:complexType>\r\n" +
77
"\t\t\t</xs:element>\r\n" +
78
"\t\t\t<xs:element name=\"bar\" type=\"xs:string\"/>\r\n" +
79
"\t\t</xs:choice>\r\n" +