~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.XmlEditor/Tests/Parser/AttributeNameUnderCursorTests.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1

 
2
using MonoDevelop.XmlEditor;
 
3
using NUnit.Framework;
 
4
using System;
 
5
 
 
6
namespace MonoDevelop.XmlEditor.Tests.Parser
 
7
{
 
8
        [TestFixture]
 
9
        public class AttributeNameUnderCursorTests
 
10
        {
 
11
                [Test]
 
12
                public void SuccessTest1()
 
13
                {
 
14
                        string text = "<a foo";
 
15
                        Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.Length));
 
16
                }
 
17
                
 
18
                [Test]
 
19
                public void SuccessTest2()
 
20
                {
 
21
                        string text = "<a foo";
 
22
                        Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.IndexOf("foo")));
 
23
                }
 
24
                
 
25
                [Test]
 
26
                public void SuccessTest3()
 
27
                {
 
28
                        string text = "<a foo";
 
29
                        Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.IndexOf("oo")));
 
30
                }
 
31
                
 
32
                [Test]
 
33
                public void SuccessTest4()
 
34
                {
 
35
                        string text = "<a foo";
 
36
                        Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.Length - 2));
 
37
                }
 
38
                
 
39
                [Test]
 
40
                public void SuccessTest5()
 
41
                {
 
42
                        string text = "<a foo=";
 
43
                        Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, 3));
 
44
                }
 
45
                
 
46
                [Test]
 
47
                public void SuccessTest6()
 
48
                {
 
49
                        string text = "<a foo=";
 
50
                        Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.Length));
 
51
                }
 
52
                
 
53
                [Test]
 
54
                public void SuccessTest7()
 
55
                {
 
56
                        string text = "<a foo='";
 
57
                        Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.Length));
 
58
                }
 
59
                
 
60
                [Test]
 
61
                public void SuccessTest8()
 
62
                {
 
63
                        string text = "<a type='a";
 
64
                        Assert.AreEqual("type", XmlParser.GetAttributeNameAtIndex(text, text.Length));
 
65
                }
 
66
                
 
67
                [Test]
 
68
                public void SuccessTest9()
 
69
                {
 
70
                        string text = "<a type='a'";
 
71
                        Assert.AreEqual("type", XmlParser.GetAttributeNameAtIndex(text, text.Length - 1));
 
72
                }
 
73
        }
 
74
}