2
using MonoDevelop.Ide.CodeCompletion;
3
using MonoDevelop.XmlEditor;
7
using System.Xml.Schema;
8
using MonoDevelop.XmlEditor.Tests.Schema;
9
using MonoDevelop.XmlEditor.Tests.Utils;
11
namespace MonoDevelop.XmlEditor.Tests.FindSchemaObject
14
/// Tests that an xs:attributeGroup/@ref is located in the schema.
17
public class AttributeGroupReferenceSelectedTestFixture : SchemaTestFixtureBase
19
XmlSchemaAttributeGroup schemaAttributeGroup;
21
public override void FixtureInit()
23
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
24
schemas.Add(SchemaCompletionData);
25
XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
26
schemas.Add(xsdSchemaCompletionData);
27
XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty, null);
29
string xml = GetSchema();
30
int index = xml.IndexOf("ref=\"coreattrs\"");
31
index = xml.IndexOf("coreattrs", index);
32
schemaAttributeGroup = (XmlSchemaAttributeGroup)XmlEditorView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
36
public void AttributeGroupName()
38
Assert.AreEqual("coreattrs", schemaAttributeGroup.QualifiedName.Name);
41
protected override string GetSchema()
43
return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
44
"<xs:attributeGroup name=\"coreattrs\">" +
45
"\t<xs:attribute name=\"id\" type=\"xs:string\"/>" +
46
"\t<xs:attribute name=\"style\" type=\"xs:string\"/>" +
47
"\t<xs:attribute name=\"title\" type=\"xs:string\"/>" +
48
"</xs:attributeGroup>" +
49
"\t<xs:element name=\"note\">\r\n" +
50
"\t\t<xs:complexType>\r\n" +
51
"\t\t\t<xs:attributeGroup ref=\"coreattrs\"/>" +
52
"\t\t\t<xs:attribute name=\"name\" type=\"xs:string\"/>\r\n" +
53
"\t\t</xs:complexType>\r\n" +
54
"\t</xs:element>\r\n" +