2
using MonoDevelop.XmlEditor;
7
namespace MonoDevelop.XmlEditor.Tests.Parser
10
/// Tests that we can detect the attribute's name.
13
public class AttributeNameTestFixture
16
public void SuccessTest1()
18
string text = " foo='a";
19
Assert.AreEqual("foo", XmlParser.GetAttributeName(text, text.Length), "Should have retrieved the attribute name 'foo'");
23
public void SuccessTest2()
25
string text = " foo='";
26
Assert.AreEqual("foo", XmlParser.GetAttributeName(text, text.Length), "Should have retrieved the attribute name 'foo'");
30
public void SuccessTest3()
32
string text = " foo=";
33
Assert.AreEqual("foo", XmlParser.GetAttributeName(text, text.Length), "Should have retrieved the attribute name 'foo'");
37
public void SuccessTest4()
39
string text = " foo=\"";
40
Assert.AreEqual("foo", XmlParser.GetAttributeName(text, text.Length), "Should have retrieved the attribute name 'foo'");
44
public void SuccessTest5()
46
string text = " foo = \"";
47
Assert.AreEqual("foo", XmlParser.GetAttributeName(text, text.Length), "Should have retrieved the attribute name 'foo'");
51
public void SuccessTest6()
53
string text = " foo = '#";
54
Assert.AreEqual("foo", XmlParser.GetAttributeName(text, text.Length), "Should have retrieved the attribute name 'foo'");
58
public void FailureTest1()
61
Assert.AreEqual(String.Empty, XmlParser.GetAttributeName(text, text.Length), "Should have retrieved the attribute name 'foo'");
65
public void FailureTest2()
67
string text = "foo=<";
68
Assert.AreEqual(String.Empty, XmlParser.GetAttributeName(text, text.Length), "Should have retrieved the attribute name 'foo'");
72
public void FailureTest3()
75
Assert.AreEqual(String.Empty, XmlParser.GetAttributeName(text, text.Length));
79
public void FailureTest4()
82
Assert.AreEqual(String.Empty, XmlParser.GetAttributeName(text, text.Length));
86
public void EmptyString()
88
Assert.AreEqual(String.Empty, XmlParser.GetAttributeName(String.Empty, 10));