//
//
//
//
// $Revision$
//
using System;
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
namespace XmlEditor.Tests.Schema
{
///
/// Element that has a single attribute.
///
[TestFixture]
public class ElementWithAttributeSchemaTestFixture : SchemaTestFixtureBase
{
XmlCompletionItemCollection attributeCompletionItems;
string attributeName;
public override void FixtureInit()
{
XmlElementPath path = new XmlElementPath();
path.AddElement(new QualifiedName("note", "http://www.w3schools.com"));
attributeCompletionItems = SchemaCompletion.GetAttributeCompletion(path);
attributeName = attributeCompletionItems[0].Text;
}
[Test]
public void AttributeCount()
{
Assert.AreEqual(1, attributeCompletionItems.Count, "Should be one attribute.");
}
[Test]
public void AttributeName()
{
Assert.AreEqual("name", attributeName, "Attribute name is incorrect.");
}
[Test]
public void NoAttributesForUnknownElement()
{
XmlElementPath path = new XmlElementPath();
path.AddElement(new QualifiedName("foobar", "http://www.w3schools.com"));
XmlCompletionItemCollection attributes = SchemaCompletion.GetAttributeCompletion(path);
Assert.AreEqual(0, attributes.Count, "Should not find attributes for unknown element.");
}
protected override string GetSchema()
{
return "\r\n" +
" \r\n" +
" \r\n" +
"\t\r\n" +
" \r\n" +
" \r\n" +
"";
}
}
}