Example #1
0
        public void Equality()
        {
            var a = new Text("en", "hello world");
            var b = new Text("en", "hello world");
            var c = new Text("en-AU", "g'day mate");
            //Text d = null;

            Assert.IsTrue(a.Equals(a));
            Assert.IsTrue(a.Equals(b));
            Assert.IsFalse(a.Equals(c));
            //Assert.IsFalse(a.Equals(d));

            Assert.IsTrue(b.Equals(a));
            Assert.IsTrue(b.Equals(b));
            Assert.IsFalse(b.Equals(c));
            //Assert.IsFalse(b.Equals(d));

            Assert.IsFalse(c.Equals(a));
            Assert.IsFalse(c.Equals(b));
            Assert.IsTrue(c.Equals(c));
            //Assert.IsFalse(c.Equals(d));

            Assert.IsTrue(a.Equals((object) a));
            Assert.IsTrue(a.Equals((object) b));
            Assert.IsFalse(a.Equals((object) c));
            Assert.IsFalse(a.Equals((object) null));
        }
Example #2
0
 public void NullEquality()
 {
     var a = new Text("en", "hello world");
     Assert.IsFalse(a  ==  null);
     Assert.IsTrue(a != null);
     Assert.IsFalse(a.Equals(null));
 }