2
using MonoDevelop.Ide.CodeCompletion;
3
using MonoDevelop.XmlEditor;
8
namespace MonoDevelop.XmlEditor.Tests.Schema
11
/// Element that has a single attribute.
14
public class ElementWithAttributeSchemaTestFixture : SchemaTestFixtureBase
16
ICompletionData[] attributeCompletionData;
17
string[] attributeName;
19
public override void FixtureInit()
21
XmlElementPath path = new XmlElementPath();
22
path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
24
attributeCompletionData = SchemaCompletionData.GetAttributeCompletionData(path);
25
attributeName = attributeCompletionData[0].Text;
29
public void AttributeCount()
31
Assert.AreEqual(1, attributeCompletionData.Length, "Should be one attribute.");
35
public void AttributeName()
37
Assert.AreEqual("name", attributeName[0], "Attribute name is incorrect.");
41
public void AttributeNameOverloadCount()
43
Assert.AreEqual(1, attributeName.Length, "Should only be one item in the array.");
47
public void NoAttributesForUnknownElement()
49
XmlElementPath path = new XmlElementPath();
50
path.Elements.Add(new QualifiedName("foobar", "http://www.w3schools.com"));
51
ICompletionData[] attributes = SchemaCompletionData.GetAttributeCompletionData(path);
53
Assert.AreEqual(0, attributes.Length, "Should not find attributes for unknown element.");
56
protected override string GetSchema()
58
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" +
59
" <xs:element name=\"note\">\r\n" +
60
" <xs:complexType>\r\n" +
61
"\t<xs:attribute name=\"name\" type=\"xs:string\"/>\r\n" +
62
" </xs:complexType>\r\n" +
63
" </xs:element>\r\n" +