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

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.XmlEditor/Tests/Parser/QualifiedNameTestFixture.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
using System.Xml;
 
6
 
 
7
namespace MonoDevelop.XmlEditor.Tests.Parser
 
8
{
 
9
        /// <summary>
 
10
        /// Tests the comparison of <see cref="QualifiedName"/> items.
 
11
        /// </summary>
 
12
        [TestFixture]
 
13
        public class QualifiedNameTestFixture
 
14
        {
 
15
                [Test]
 
16
                public void EqualsTest1()
 
17
                {
 
18
                        QualifiedName name1 = new QualifiedName("foo", "http://foo.com");
 
19
                        QualifiedName name2 = new QualifiedName("foo", "http://foo.com");
 
20
                        
 
21
                        Assert.AreEqual(name1, name2, "Should be the same.");
 
22
                }
 
23
                
 
24
                [Test]
 
25
                public void EqualsTest2()
 
26
                {
 
27
                        QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
 
28
                        QualifiedName name2 = new QualifiedName("foo", "http://foo.com", "f");
 
29
                        
 
30
                        Assert.AreEqual(name1, name2, "Should be the same.");
 
31
                }               
 
32
                
 
33
                [Test]
 
34
                public void EqualsTest3()
 
35
                {
 
36
                        QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
 
37
                        QualifiedName name2 = new QualifiedName("foo", "http://foo.com", "ggg");
 
38
                        
 
39
                        Assert.IsTrue(name1 == name2, "Should be the same.");
 
40
                }       
 
41
                
 
42
                [Test]
 
43
                public void NotEqualsTest1()
 
44
                {
 
45
                        QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
 
46
                        QualifiedName name2 = new QualifiedName("foo", "http://bar.com", "f");
 
47
                        
 
48
                        Assert.IsFalse(name1 == name2, "Should not be the same.");
 
49
                }               
 
50
                
 
51
                [Test]
 
52
                public void NotEqualsTest2()
 
53
                {
 
54
                        QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
 
55
                        QualifiedName name2 = null; 
 
56
                        
 
57
                        Assert.IsFalse(name1 == name2, "Should not be the same.");
 
58
                }
 
59
                
 
60
                [Test]
 
61
                public void HashCodeTest()
 
62
                {
 
63
                        QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
 
64
                        XmlQualifiedName xmlQualifiedName = new XmlQualifiedName("foo", "http://foo.com");
 
65
 
 
66
                        Assert.AreEqual(name1.GetHashCode(), xmlQualifiedName.GetHashCode());
 
67
                }               
 
68
        }
 
69
}