Exemple #1
0
        public void Equals_ValuesAreTheSame()
        {
            string str = "abc";
            NonNullable <string> str2 = "abc";

            Assert.IsTrue(str2.Equals(str));
        }
Exemple #2
0
        public void EqualityMethod()
        {
            string x = new string('1', 10);
            string y = new string('1', 10);
            string z = new string('z', 10);

            NonNullable <string> xx = x;
            NonNullable <string> yy = y;
            NonNullable <string> zz = z;
            NonNullable <string> nn = new NonNullable <string>();

            Assert.IsTrue(xx.Equals(xx));
            Assert.IsTrue(xx.Equals(yy));
            Assert.IsFalse(xx.Equals(zz));
            Assert.IsFalse(xx.Equals(nn));
            Assert.IsFalse(nn.Equals(xx));
        }
        public void NonNullables_WithSameValue_Equal()
        {
            var test  = Test.Create();
            var test2 = test;

            var first  = new NonNullable <object>(test);
            var second = new NonNullable <object>(test);

            Assert.AreEqual(first, second);
            Assert.IsTrue(NonNullable.Equals(first, second));
        }
Exemple #4
0
        public void EqualityMethod()
        {
            string x = new string('1', 10);
            string y = new string('1', 10);
            string z = new string('z', 10);

            NonNullable<string> xx = x;
            NonNullable<string> yy = y;
            NonNullable<string> zz = z;
            NonNullable<string> nn = new NonNullable<string>();

            Assert.IsTrue(xx.Equals(xx));
            Assert.IsTrue(xx.Equals(yy));
            Assert.IsFalse(xx.Equals(zz));
            Assert.IsFalse(xx.Equals(nn));
            Assert.IsFalse(nn.Equals(xx));
        }