~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/DisplayBindings/XmlEditor/Test/Parser/QualifiedNameTestFixture.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using ICSharpCode.XmlEditor;
 
5
using NUnit.Framework;
 
6
using System;
 
7
using System.Xml;
 
8
 
 
9
namespace XmlEditor.Tests.Parser
 
10
{
 
11
        /// <summary>
 
12
        /// Tests the comparison of <see cref="QualifiedName"/> items.
 
13
        /// </summary>
 
14
        [TestFixture]
 
15
        public class QualifiedNameTestFixture
 
16
        {
 
17
                [Test]
 
18
                public void EqualsTest1()
 
19
                {
 
20
                        QualifiedName name1 = new QualifiedName("foo", "http://foo.com");
 
21
                        QualifiedName name2 = new QualifiedName("foo", "http://foo.com");
 
22
                        
 
23
                        Assert.AreEqual(name1, name2, "Should be the same.");
 
24
                }
 
25
                
 
26
                [Test]
 
27
                public void EqualsTest2()
 
28
                {
 
29
                        QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
 
30
                        QualifiedName name2 = new QualifiedName("foo", "http://foo.com", "f");
 
31
                        
 
32
                        Assert.AreEqual(name1, name2, "Should be the same.");
 
33
                }               
 
34
                
 
35
                [Test]
 
36
                public void EqualsTest3()
 
37
                {
 
38
                        QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
 
39
                        QualifiedName name2 = new QualifiedName("foo", "http://foo.com", "ggg");
 
40
                        
 
41
                        Assert.IsTrue(name1 == name2, "Should be the same.");
 
42
                }       
 
43
                
 
44
                [Test]
 
45
                public void NotEqualsTest1()
 
46
                {
 
47
                        QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
 
48
                        QualifiedName name2 = new QualifiedName("foo", "http://bar.com", "f");
 
49
                        
 
50
                        Assert.IsFalse(name1 == name2, "Should not be the same.");
 
51
                }               
 
52
                
 
53
                [Test]
 
54
                public void NotEqualsTest2()
 
55
                {
 
56
                        QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
 
57
                        QualifiedName name2 = null; 
 
58
                        
 
59
                        Assert.IsFalse(name1 == name2, "Should not be the same.");
 
60
                }               
 
61
                
 
62
                [Test]
 
63
                public void HashCodeTest()
 
64
                {
 
65
                        QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
 
66
                        XmlQualifiedName xmlQualifiedName = new XmlQualifiedName("foo", "http://foo.com");
 
67
 
 
68
                        Assert.AreEqual(name1.GetHashCode(), xmlQualifiedName.GetHashCode());
 
69
                }
 
70
        }
 
71
}