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:element/@type="prefix:name" is located in the schema.
17
public class ElementTypeWithPrefixSelectedTestFixture : SchemaTestFixtureBase
19
XmlSchemaComplexType schemaComplexType;
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("type=\"xs:complexType\"");
31
index = xml.IndexOf("xs:complexType", index);
32
schemaComplexType = (XmlSchemaComplexType)XmlEditorView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
36
public void ComplexTypeName()
38
Assert.AreEqual("complexType", schemaComplexType.QualifiedName.Name);
42
public void ComplexTypeNamespace()
44
Assert.AreEqual("http://www.w3.org/2001/XMLSchema", schemaComplexType.QualifiedName.Namespace);
47
protected override string GetSchema()
49
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" +
50
"\t<xs:element name=\"note\">\r\n" +
51
"\t\t<xs:complexType> \r\n" +
52
"\t\t\t<xs:sequence>\r\n" +
53
"\t\t\t\t<xs:element name=\"text\" type=\"xs:complexType\"/>\r\n" +
54
"\t\t\t</xs:sequence>\r\n" +
55
"\t\t</xs:complexType>\r\n" +
56
"\t</xs:element>\r\n" +