2
using MonoDevelop.XmlEditor;
6
namespace MonoDevelop.XmlEditor.Tests.Parser
9
public class AttributeNameUnderCursorTests
12
public void SuccessTest1()
14
string text = "<a foo";
15
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.Length));
19
public void SuccessTest2()
21
string text = "<a foo";
22
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.IndexOf("foo")));
26
public void SuccessTest3()
28
string text = "<a foo";
29
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.IndexOf("oo")));
33
public void SuccessTest4()
35
string text = "<a foo";
36
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.Length - 2));
40
public void SuccessTest5()
42
string text = "<a foo=";
43
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, 3));
47
public void SuccessTest6()
49
string text = "<a foo=";
50
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.Length));
54
public void SuccessTest7()
56
string text = "<a foo='";
57
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.Length));
61
public void SuccessTest8()
63
string text = "<a type='a";
64
Assert.AreEqual("type", XmlParser.GetAttributeNameAtIndex(text, text.Length));
68
public void SuccessTest9()
70
string text = "<a type='a'";
71
Assert.AreEqual("type", XmlParser.GetAttributeNameAtIndex(text, text.Length - 1));