📄 enumattributevaluetestfixture.cs
字号:
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision: 915 $</version>
// </file>
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using System.IO;
namespace XmlEditor.Tests.Schema
{
/// <summary>
/// Tests attribute refs
/// </summary>
[TestFixture]
public class EnumAttributeValueTestFixture : SchemaTestFixtureBase
{
ICompletionData[] attributeValues;
public override void FixtureInit()
{
XmlElementPath path = new XmlElementPath();
path.Elements.Add(new QualifiedName("foo", "http://foo.com"));
attributeValues = SchemaCompletionData.GetAttributeValueCompletionData(path, "id");
}
[Test]
public void IdAttributeHasValueOne()
{
Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeValues, "one"),
"Missing attribute value 'one'");
}
[Test]
public void IdAttributeHasValueTwo()
{
Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeValues, "two"),
"Missing attribute value 'two'");
}
[Test]
public void IdAttributeValueCount()
{
Assert.AreEqual(2, attributeValues.Length, "Expecting 2 attribute values.");
}
protected override string GetSchema()
{
return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://foo.com\" targetNamespace=\"http://foo.com\" elementFormDefault=\"qualified\">\r\n" +
"\t<xs:element name=\"foo\">\r\n" +
"\t\t<xs:complexType>\r\n" +
"\t\t\t<xs:attribute name=\"id\">\r\n" +
"\t\t\t\t<xs:simpleType>\r\n" +
"\t\t\t\t\t<xs:restriction base=\"xs:string\">\r\n" +
"\t\t\t\t\t\t<xs:enumeration value=\"one\"/>\r\n" +
"\t\t\t\t\t\t<xs:enumeration value=\"two\"/>\r\n" +
"\t\t\t\t\t</xs:restriction>\r\n" +
"\t\t\t\t</xs:simpleType>\r\n" +
"\t\t\t</xs:attribute>\r\n" +
"\t\t</xs:complexType>\r\n" +
"\t</xs:element>\r\n" +
"</xs:schema>";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -