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

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.XmlEditor/Tests/Parser/AttributeValueUnderCursorTests.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 AttributeValueUnderCursorTests
 
10
        {
 
11
                [Test]
 
12
                public void SuccessTest1()
 
13
                {
 
14
                        string text = "<a foo='abc'";
 
15
                        Assert.AreEqual("abc", XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
 
16
                }
 
17
                
 
18
                [Test]
 
19
                public void SuccessTest2()
 
20
                {
 
21
                        string text = "<a foo=\"abc\"";
 
22
                        Assert.AreEqual("abc", XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
 
23
                }
 
24
                
 
25
                [Test]
 
26
                public void SuccessTest3()
 
27
                {
 
28
                        string text = "<a foo='abc'";
 
29
                        Assert.AreEqual("abc", XmlParser.GetAttributeValueAtIndex(text, text.Length - 2));
 
30
                }
 
31
                
 
32
                [Test]
 
33
                public void SuccessTest4()
 
34
                {
 
35
                        string text = "<a foo='abc'";
 
36
                        Assert.AreEqual("abc", XmlParser.GetAttributeValueAtIndex(text, text.IndexOf("abc")));
 
37
                }
 
38
                
 
39
                [Test]
 
40
                public void SuccessTest5()
 
41
                {
 
42
                        string text = "<a foo=''";
 
43
                        Assert.AreEqual(String.Empty, XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
 
44
                }
 
45
                
 
46
                [Test]
 
47
                public void SuccessTest6()
 
48
                {
 
49
                        string text = "<a foo='a'";
 
50
                        Assert.AreEqual("a", XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
 
51
                }
 
52
                
 
53
                [Test]
 
54
                public void SuccessTest7()
 
55
                {
 
56
                        string text = "<a foo='a\"b\"c'";
 
57
                        Assert.AreEqual("a\"b\"c", XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
 
58
                }
 
59
                
 
60
                [Test]
 
61
                public void FailureTest1()
 
62
                {
 
63
                        string text = "<a foo='a";
 
64
                        Assert.AreEqual(String.Empty, XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
 
65
                }
 
66
        }
 
67
}